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.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to