Link to home
Start Free TrialLog in
Avatar of lawrence_dev
lawrence_dev

asked on

How do I speed up this PDO query

I have indexed the SKU column in both DB tables.  How do I speed this query up?   (There are 20,000+ records in table "Download")

I was using WHERE NOT IN and thought I could speed it up some  by using a LEFT JOIN and IS NULL.

Thanks for your help!!

$query1 = $conn->query('SELECT DISTINCT `Download`.SKU FROM `Download` LEFT JOIN MissingDescriptions ON `Download`.SKU = MissingDescriptions.SKU WHERE MissingDescriptions.SKU IS NULL');

Open in new window

Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

I don't understand.  What result are you looking for?  I'm not sure you can do a JOIN on NULL data.
Avatar of lawrence_dev
lawrence_dev

ASKER

I am downloading better descriptions directly from a distributor (that are not provided in the product feed).  

If my PHP script or the distributor's website times the script out, I want to start again where it quit.

Thanks for your help!
ASKER CERTIFIED SOLUTION
Avatar of Mukesh Yadav
Mukesh Yadav
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I appreciate the help!!  That worked perfect!!