473,323 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Query by date optimization

Hi
*Edit* I ran some tests and wanted to edit my question. Basically I just would like to know:

If I have an date field as part of a multicolumn primary key, would it be best to create a nonclustered index on just the invoice date field?

There are 760 million records and the result set is one week worth of data - 150,000 records.

Looking for the best practice. The data is historical and is never modified.
Dec 7 '10 #1
2 1359
I am learning data warehousing and analysis services as I am starting to think this may be the best approach.
Dec 7 '10 #2
ck9663
2,878 Expert 2GB
Rule of thumb:

If there's only one index on the table, make it clustered.

The primary key is the column mostly used for filtering your data and should be unique. (Aside from the book definition of PK). PK is primarily used to preserve the uniqueness of the record. Indexes are more of optimization than anything else.

Try to include the most commonly used column in WHERE clause on your index.

If all else fails, start from here...


Good Luck!!!

~~ CK
Dec 7 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Leonardo Almeida | last post by:
Hi, I have a table with the follow fields : ID - Int Date - Datetime I need to make a simple query to result the records between to dates with a single ID.
1
by: Raghu | last post by:
Hello... I am running into a problem while running a query..can some1 help.. this is the query : ************** SELECT * from Table S where S.dtDate1 BETWEEN...
2
by: jmev7 | last post by:
I had a query with a criteria in a date field reading "> And <", and when run, it correctly prompted first for the param, and then for the param. I then created functions to replace these params...
1
by: Dalan | last post by:
I have attempted to resolve a problem regarding erroneous output using a Between And parameter on several Access 97 queries, but to no avail. The queries are used for report output and...
1
by: Brian Jorgenson | last post by:
I am looking for a formula to put in my query to pull data based on the last 3 months. It starts with the current day and will go back 3 months. Here is my wrkflow language for example: ...
2
by: zdk | last post by:
I have table name "actionlog",and one field in there is "date_time" date_time (Type:datetime) example value : 11/1/2006 11:05:07 if I'd like to query date between 24/07/2006 to 26/07/2006(I...
0
by: agtsrbt | last post by:
I'm just beginning to use SQL for MS Queries in Excel and am having difficulty with how to imput the date into a prompt. I've used prompts for other fields and they seem to work fine, however,...
3
by: ElTipo | last post by:
Hello People, Is possible to write in reporte a query parameter? example Between and I need to put in report the Start date and End Date if the user put this date range in the popup...
23
by: phill86 | last post by:
Hi I have a form with two fields that represent a date range for example 20-7-09 to 26-7-09 I am running the query below and it only returns the date range from 20-7-09 to the 25-7-09 as you...
19
by: phill86 | last post by:
Hi I am re-posting this thread because it has become very confusing and I have got some way to solving the problem so it is a slightly different question from the initial thread. here is the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.