[PHP] rather a mysql question
Sorry that this is more of a mysql question, but since most php programmers use it a lot, i though i might find the answer without subscribing to mysql list, here goes: When i do a query from a big table using indexes,it takes for example 5 seconds. Now if i, after some time repeat the query, the query takes about 0.5 secs. So far i thought it was because of caching, but now i read mysql (v3.23) doesnt support query cache. So this really gets me wondering, where does the speed increase come from? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] rather a mysql question
[snip] When i do a query from a big table using indexes,it takes for example 5 seconds. Now if i, after some time repeat the query, the query takes about 0.5 secs. So far i thought it was because of caching, but now i read mysql (v3.23) doesnt support query cache. So this really gets me wondering, where does the speed increase come from? [/snip] As I understand it, queries create temporary indexes specific to the query. The same (same) query will be theoretically much quicker if those temp indexes are there. But you can't count on them. Here's why... Me - Query DB Create TMP INDEX Query DB - Someone else Destroy Existing TMP INDEX Create New TMP INDEX Me - Re-Query DB (same query as before) Destroy Existing TMP INDEX Create New TMP INDEX And so on --Someone else Hope this helps as this is the way it was explained to me quite a long time ago, so I may not have the flow exactly right. Jay Blanchard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] rather a mysql question
Depending on your OS, there's a good possibility that the OS is caching HD data. So instead of mysql reading directly from disk, it's getting it from the memory cache. Depending on how heavily your server is used, wait 10 or 15 mins (to let the memory cache clear out) and try it again. Mike... Ando Saabas wrote: Sorry that this is more of a mysql question, but since most php programmers use it a lot, i though i might find the answer without subscribing to mysql list, here goes: When i do a query from a big table using indexes,it takes for example 5 seconds. Now if i, after some time repeat the query, the query takes about 0.5 secs. So far i thought it was because of caching, but now i read mysql (v3.23) doesnt support query cache. So this really gets me wondering, where does the speed increase come from? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php