This is a discussion on SQLITE within the PHP General forums, part of the PHP Programming Forums category; Hi, I've got questions: I've got sqlite like PHP module (under windows). I tried this: a)execute script ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi, I've got questions:
I've got sqlite like PHP module (under windows). I tried this: a)execute script 1 (selecting from some table), it tooks 2 minutes b)execute script 2 , it tooks 3 minutes c)execute them both at the same time (from different browser windows), both of them stopped also at the same time and it tooks 5 minutes I've tried another questions and both of the scripts allways stopped at the same time with duration of he sum of the time fo each process separated. This is not, of course, the behaviour I would expect... Is this some feature of sqlite or an I doing something wrong?? I've also tried the same with MySql and the result should be like 1/ first script alone - 2 minutes 2/ second script alone - 3 minutes 3/ both of them at the same time - first took 3 minutes, second took 4 minutes... Brona |
|
|||
|
--- Bronislav_Klučka <Bronislav.Klucka@pro2-soft.com> wrote:
> Hi, I've got questions: I only noticed one. > I've got sqlite like PHP module (under windows). I tried this: > a)execute script 1 (selecting from some table), it tooks 2 minutes > b)execute script 2 , it tooks 3 minutes > c)execute them both at the same time (from different browser > windows), both of them stopped also at the same time and it tooks > 5 minutes [snip] > Is this some feature of sqlite or an I doing something wrong? Without seeing any code or being given any details, all I can make is an educated guess. SQLite uses the filesystem for storage. If your queries are needing to access the same file (maybe you're querying the same table), SQLite is going to serialize those queries to help you avoid threading problems. So, your queries are going to basically take turns. Hope that helps. Chris ===== Chris Shiflett - http://shiflett.org/ PHP Security Handbook Coming mid-2004 HTTP Developer's Handbook http://httphandbook.org/ RAMP Training Courses http://www.nyphp.org/ramp |
|
|||
|
That's my code:
$dbfile="db.sdb"; $db=sqlite_open($dbfile); $res=sqlite_query($db,"select a.*,b.* from a left join b on a.id=b.id_a where a.name like \"%1%\" or b.street like \"%1%\" order by cellphone"); echo sqlite_num_rows($res).CRLF; sqlite_close($db); It's realy just "benchmark" I've done. I'm pretty much aware of system sqlite is useing to store the data, and I also find obvious that if it would be runnig like web database module, users will ask the same table ata the same time (like with other db system, they are looking at the same page) but I find it not good, I was only asking if there is a "way to change it" Bronislav Klucka > > > Is this some feature of sqlite or an I doing something wrong? > > Without seeing any code or being given any details, all I can make is an > educated guess. SQLite uses the filesystem for storage. If your queries > are needing to access the same file (maybe you're querying the same > table), SQLite is going to serialize those queries to help you avoid > threading problems. So, your queries are going to basically take turns. > |
|
|||
|
* Thus wrote Bronislav Klučka (Bronislav.Klucka@pro2-soft.com):
> Hi, I've got questions: > > I've got sqlite like PHP module (under windows). I tried this: > a)execute script 1 (selecting from some table), it tooks 2 minutes > b)execute script 2 , it tooks 3 minutes > c)execute them both at the same time (from different browser windows), both > of them stopped also at the same time and it tooks 5 minutes Read the sqlite faq: http://sqlite.org/faq.html#q7 Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ |