Hi all, found this site and I hope one of you could help me to solve the following problem:

The SELECT would examine too many records and probably
take a very long time. Check your WHERE and use SET OPTION

The query:

$qry=$DB->sql_qry("SELECT p.*,COUNT(c.id) AS num,k.kategorie
AS katname FROM ".$this->sql_table["pics"]." AS p LEFT JOIN ".$this-
>sql_table['comments']." AS c ON p.id = c.pid LEFT JOIN ".$this-
>sql_table['kategorie']." AS k ON p.kategorie = k.id $this->katadd
GROUP BY p.id");

(part of the PHP)
It is a photo script, it shows photos/hits/comments and if they are
all together more then 4500 the error will show up. Íf I make sure
it is below that, no problems at all. I have a Forum running with
13000 posts so I think it isn't my database/server..

How should I set that option? Add somthing? I tried to find this
solution on google without succes. I hope I'm on the right place now!


PS. I'm a real N00B in this...

More info:
System Debian GNU/Linux - Bi PIII 1Ghz - 1 Gb RAM - Kernel 2.4.x