Re: Query takes terribly long
| From: | Andrew Kreps | Date: | Sat, 18 Sep 2004 21:06:11 +0000 |
| Subject: | Re: Query takes terribly long | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197125@lists.php.net to get a copy of this message | ||
On Sat, 18 Sep 2004 22:25:12 +0200, Dirk Schippers
<dirk.schippers@frixx-it.com> wrote:
>
> with indexes: id = primary, putdatetime, userid,
> {put,front,topcategory,approvedby} and review.
>
> If I want to know the 30 most recently added and approved items, I do
> the following simple query:
> SELECT id FROM story WHERE put=1 AND front=1 AND topcategory=1 ORDER BY
> putdatetime DESC LIMIT 0,30
>
I couldn't help but notice that your query isn't specifying that the
records you want are approved. Does your query time improve if you
add approvedby to the query?