php - MySQL result to large -


I have 2 tables, both of which have 300,000 values ​​for technical reasons, we can directly match timestamps or a unique ID can not do.

But we want to achieve this result:

  SELECT * ads from del.icio. (AdsDelivered.session = pageViews.session and adsDelivered.referer = pageViews.referer and abs (unix_timestamp (adsDelivered.timeCreated) - unix_timestamp (pageview time edited)) & lt; = 5) where pageviews Timeline & gt; = '2013-03 -21 00:00:00' and Pageviews. Timed & lt; = '2013-03-21 23:59:59' LIMIT 100   

The response is bigger and takes longer.

I recommend planning an expansion on the query. If you see a table scan, you will know that you have to type the query again so that you can use the index effectively.

I'm guessing that this is the time-generated that is killing you, because you have to scan every single row to see, which is a WHERE segment Satisfies.

Having some operations that cuts down the size of the required set for you to scan, it will be a great deal to use indexed also to make sure the columns in the WHERE section are properly indexed. , Then rewrite the query so that it can benefit them.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

jsp - Google line chart x-axis shrinks on transition -

java - Reaching JTextField in a DocumentListener -