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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

fast select

Status
Not open for further replies.

jimbojames5645

Programmer
Dec 12, 2003
36
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?
 
perhaps leave out the count option. if there are records in the recordset you can see that by the number of rows returned


$query="SELECT field from tablename where field ='$data";
$rs=mysql_query($query,$conn);
$list = mysql_num_rows($rs);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top