Re: Problem with mysql and php
| From: | David Robley | Date: | Tue, 29 Nov 2011 09:14:47 +0000 |
| Subject: | Re: Problem with mysql and php | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-48107@lists.php.net to get a copy of this message | ||
Jason Pruim wrote:
> Given the following 2 queries:
>
> "SELECT DISTINCT areacode FROM main WHERE state = '{$query_exploded[0]}'";
>
> "SELECT DISTINCT areacode FROM main";
>
> The second displays ALOT faster.... Like by minutes... the first one is
> what I really want though.... Currently working with a dataset of 89
> million records, will be expanding that to many many more times that... To
> the tune of possibly a couple billion records...
>
> Any ideas? :)
>
>
> Jason Pruim
> lists@pruimphotography.com
Absolutely the first thing I would do is an EXPLAIN on the slow query, and
work from the results of that. I'd hazard a guess that there might be
indexing problems.
http://dev.mysql.com/doc/refman/5.1/en/using-explain.html
Cheers
--
David Robley
Insert inevitable trivial witticism of your choice.
Today is Pungenday, the 41st day of The Aftermath in the YOLD 3177.