Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    1

    Unanswered: 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

  2. #2
    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.

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •