If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Performanace of Order by

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-27-03, 08:57
yu_hung yu_hung is offline
Registered User
 
Join Date: Jul 2003
Posts: 1
Performanace of Order by

Hi all


I have a table which will store over 10 thousand new records a day. There are two types of records in this table - queued and processed. I need to frequently execute a sql to select all the queued reocrds order by its priority.

I am not sure if the MS SQL server (or any other) would select all the queued records before sorting the records by priority or it will sort all the records in the table before retrieving the queued records. Does anyone knows about this? If it is former one, I think there will not be a performance problem because records in queued status is only a very small subset of the table, otherwise I have to change the structure of the table and program to enhance the performance.


Thank you very much!!!

Edmond
Reply With Quote
  #2 (permalink)  
Old 07-27-03, 21:34
timmoser timmoser is offline
Registered User
 
Join Date: Jan 2003
Posts: 67
Re: Performanace of Order by

Put an index on the priority field. I think if you index the table the way you what it then it really wont matter. Another thing to do is test it.

Hope this helps.

Quote:
Originally posted by yu_hung
Hi all


I have a table which will store over 10 thousand new records a day. There are two types of records in this table - queued and processed. I need to frequently execute a sql to select all the queued reocrds order by its priority.

I am not sure if the MS SQL server (or any other) would select all the queued records before sorting the records by priority or it will sort all the records in the table before retrieving the queued records. Does anyone knows about this? If it is former one, I think there will not be a performance problem because records in queued status is only a very small subset of the table, otherwise I have to change the structure of the table and program to enhance the performance.


Thank you very much!!!

Edmond
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On