php - Using indexes correctly in SQL query -


After

I'm doing something new for using SQL and I have a question of two values ​​in two different tables I am trying to run the comparison. I've indexed the columns I'm using, but I'm not sure how sequencing works. I'm embedding in PHP and it's currently a long time (sometimes even time out) when I'm trying to run the query. There are about 250k lines in each of the two tables, so this should not be a very large query. Here is my code:

  $ users1 = mysql_num_rows (mysql_query ("select idtracker.uuid different from idtracker, download_tracker ou idtracker.uuid = download_tracker.pluginId & amp; idtracker. Date> (now () - (2000000)) ", $ conn));   

I'm not sure if it's very efficient to compare two lines straight like I'm doing here. If I can do what I can do to improve the speed of this information, then some information can be found, it will be very useful.

Thanks -Ryan

< Div class = "text" itemprop = "text">

Before you can do any real test / optimization, you need to fix the query:

  Idtracker.date & gt; (NOW () - (2000000)).   

is incorrect

if your idtracker.date type is from DATE or DATETIME and you want to compare it to any other date ( NOW () ), you have to use the mysql function or something similar.

Comments