sql - optimising a query -


I have a table in a database containing 7k plus records. I have a query that searches for a specific ID in that table Does. (ID is automatically increased)

The query is such ->

  select ID, date_time from Date_time order by DESC;  

This query will search on the 7k + data all the way ....... is not there anyway with which I can customize this query so that the search is only on 500 or 1000 records .... because these records will increase day by day and my query will be heavy and heavy. Any suggestions

I do not know if something is missing here but what is wrong with it:

Select
  id, date_time from table where id =? Id order date_time by DESC;  

More? ID is the ID you are looking for ...

And of course ID should be the primary index.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -