Jump to content

Recommended Posts

Hello!

 

I found out that some 'SELECT' SQL queries are very slow with pdo_sqlite (PHP 5.3 or PHP 5.4).
The same query entered in the sqlite3 binary is way faster.

 

Here is my project : http://we.tl/59fGSVnAXh (password : "sqlite-php")

- bench.php

- chaines_centre.db

- inc_func.php

- info_job.php

 

The info_job.php page performs 5 'SELECT' queries in 10 seconds with my Apache server. A same query is perform in less than 0.2 seconds in the sqlite3 binary (so theoretically 1 second for the whole page).

 

I tried to modify the query a bit, and the results are strange :

 

Benchmark (bench.php) on the « $bdd->query(...); » instruction :

Query 2 : select DateMonteeAuPlan, Debut, Fin, Statut from ReportJobs where NomJob = 'NSAVBASE' and NomChaine like 'DCLC257%' limit 20;

=> 0.00099992752075195 seconde(s)

 

Query 3 : select DateMonteeAuPlan, Debut, Fin, Statut from ReportJobs where NomJob = 'NSAVBASE' and NomChaine = 'DCLC25736' order by DateMonteeAuPlan DESC limit 20;

=> 0 seconde(s)

 

Query 1 : select DateMonteeAuPlan, Debut, Fin, Statut from ReportJobs where NomJob = 'NSAVBASE' and NomChaine like 'DCLC257%' order by DateMonteeAuPlan DESC limit 20;

=> 1.8629999160767 seconde(s)

 

Why is there so much differences between two query quasi-identical?

How can I improve this situation to get results as fast as the sqlite3 binary?

 

Thanks if you took the time to look out my project files.

Link to comment
https://forums.phpfreaks.com/topic/286543-select-queries-via-pdo_sqlite-are-slow/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.