Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need faster way to check to see if records are in table

Status
Not open for further replies.

jimbojames5645

Programmer
Joined
Dec 12, 2003
Messages
36
Location
US
In order to determine if a record is in a table, i am using select count(1) from tablename where field = 'data'

I have run this query for millions of records against a table that is has 10s of millions in it. Is there a faster way to check to see if a record exists, maybe checking multiple records at once?
 
When you perform count(*), MySQL doesn't actually do a count of the records that match the criterion. It examines the table descriptors to calculate the value. Just make sure that all the fields used in your criteria are indexed.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top