Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ol> <li><p>Have you profiled this query?</p> <p>"SELECT * FROM it_raw WHERE perfID = '".addslashes($feed_array['16'][$counter])."'"</p> <p>Because you run it 28000 times.. so unless it is REALLY quick, it will cause you a head ache. Use the <a href="http://dev.mysql.com/doc/refman/5.0/en/explain.html" rel="nofollow noreferrer">EXPLAIN syntax</a> and add an appropriate index if needed.</p> <p><strong>EDIT</strong>: With profile, I mean that you should try to use EXPLAIN on the mysql-prompt to see what execution plan the MySQL Query Optimizer suggests for this query. I.e, on the prompt, run:</p> <pre><code>EXPLAIN SELECT * FROM it_raw WHERE perfID = 426; # Change this id to something existing and valid </code></pre> <p>What you want to see is that it is using an index, and ONLY an index. If you don't understand the output, copy and paste it here so can I go through it with you.</p> <p><strong>UPDATE</strong>: As you can see, it takes 0.07 seconds for EVERY row in your data array, plus the time to actually query the database, transfer the result etc. This is roughly 28000 * 0.07 = 1960 seconds, or 32 minutes, just to check if the data exists or not. You need to come up with another way of checking if the data already exists... One, very simple optimization might be: </p> <pre><code>EXPLAIN SELECT perfId FROM it_raw WHERE perfID = 210968; </code></pre> <p>This way, you can use the index on perfId and don't need to visit the table</p></li> <li><p>If it is possible, try to avoid quering the database for each run in the loop. Perhaps it is possible to fetch the ids from the database into a big array of ids that will fit in PHP memory? This will be MUCH quicker than quering the database for every row in your big data array.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload