Henning Schroeder wrote:

> At 17:52 06.09.01, you wrote:
>
> >It is copying ALL of the results into the temp table.  If you can (e.g.
> >you know you will
> >never want more than N records), add a LIMIT 0,N to the end of the SELECT
> >so that when you
> >have an old timestamp it will not hang the database.
>
> as i use
>
> select count (*) from blah where blahblah;
>
> (actually i am just interested whether there is a row or not matching the
> criterion. under normal operations there should never be more than one match)
>
> i donīt understand how a limit 0,1 would help here. wouldnīt it just say
> that no more than one count(*) result should be returned (which never the
> case anyway because count(*) returns exactly one row)?

I misread your email. I thought you had a query that was 'copying into temp
table' that was not the COUNT(*) query.  Rereading your email,  I see that for
me it is better to remain silent than remove all doubt. ;-)

Do your two queries both take a long time?  What if you add a key on type and
timestamp (in that order).

>select count(*) from adviews where click="f" and uid=7618 and cid=11 and
datestamp>=999782664;
>select count(*) from chat where type="msg" and timestamp>999783881;

--Bill


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to