Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7628581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:36:55+00:00 2026-05-31T05:36:55+00:00

I am configuring a simple table in SQL Server. It is named LOG and

  • 0

I am configuring a simple table in SQL Server. It is named “LOG” and as you might expect, it is used to record logs, for later monitoring/searching/grouping the use of various applications in various manners.

The table is declared somewhat like that (simple syntax) :

LOG {
   user   varchar(8),
   timestamp  datetime,
   appname   varchar(16)
}
primary key(user,timestamp,appname)

Should I index each column in a separate index? All three in the same index?
Clustered / non-clustered?

I’d be happy to see what logic/knowledge you would apply here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:36:56+00:00Added an answer on May 31, 2026 at 5:36 am

    I’d suggest making timestamp your clustered index… since a clustered index is particularly efficient on columns that are often searched for ranges of values, and that seems to describe how you will be querying the data.

    Additionally, I’m assuming that timestamp will be sequential, which would make inserting new data into the clustered index less expensive than if there were a random distribution of the data being inserted.

    It doesn’t sound like you will be searching by user or by appname, so I wouldn’t recommend adding indexes to those columns unless you plan on joining on these values or using them in your where clause somewhere down the road.

    You suggested adding all three fields to your index, but when you do this, the index will only be used if the “leading edge” is included in your search…

    For example, if your index is (user, timestamp, appname), but you’re only searching by timestamp and appname, then that index will not be used. Because of this, its very important to consider how the data will be queried when creating your indexes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm configuring a simple service broker implementation. Locally, we use SQL Server 2008 Express
I am trying to run a simple cgi script after configuring my server. My
I wrote a simple UDP Server with Netty that simply prints out in logs
I found a tutorial for configuring server here http://www.organicdesign.co.nz/Simple_video_streaming_with_ffserver but it is for linux...
I'm having a problem with configuring Flatpages in Satchmo. I've used them before, in
I hope you'll forgive me for thinking that configuring a DNS server would be
I have a simple SM Registry where I am configuring all my instances of
I'm trying to follow this tutorial on configuring server-side SOAP tracing for my WCF
I face many times this simple and repetitive task configuring the LAMP or some
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.