Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My table contains more than 10lacs records, i need to fetch a single record from the same within a second.

Please help me

thanks in advance
Posted
Comments
Irbaz Haider Hashmi 6-Feb-13 7:17am    
Can you send the details of the query and indexes on the table?
Indexes can really help you here.

apply index on columns you are mostly using to search records from table.
Database performance optimization part 1 (Indexing strategies)[^]
Happy Coding!
:)
 
Share this answer
 
Comments
MaheshPandian 6-Feb-13 8:36am    
thanks a lot
Aarti Meswania 6-Feb-13 9:21am    
welcome! :)
Glad to help you! :)
If you need to retrieve a record quickly from a table with a large number of rows, then you are going to have to think about indexes. Basically, if you perform a search that uses a field that has an index on it, then the database engine could search through the index to perform the search, which should result in a quick retrieval.

Some points to note about indexes however.

First of all, they aren't a magic bullet. If you apply indexes to every field in a table just in case you search on that field, then you are going to make updating that table more time consuming because indexes do take a period of time to rebuild.

Secondly, it's pointless indexing a field that has a low distribution of data. What does this mean? Well, imagine that your database table contains a field holds one of two values, say Male or Female, then indexing this is absolutely pointless. (Note - this table would, of course, violate database normalisation and I wouldn't recommend this practice, but this should help you understand the issue).
 
Share this answer
 
Comments
MaheshPandian 6-Feb-13 8:36am    
thanks a lot

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900