Re: how to limit COUNT(*)

2003-07-22 Thread Fred van Engen
have a problem. Regards, Fred. > - Original Message - > From: "Fred van Engen" <[EMAIL PROTECTED]> > To: "Mojtaba Faridzad" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, July 22, 2003 10:52 AM > Subject: Re: how to

Re: how to limit COUNT(*)

2003-07-22 Thread Mojtaba Faridzad
without limit, limit was faster. thanks for your help - Original Message - From: "Fred van Engen" <[EMAIL PROTECTED]> To: "Mojtaba Faridzad" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 10:52 AM Subject: Re: how to limi

Re: how to limit COUNT(*)

2003-07-22 Thread Fred van Engen
-- Original Message - > From: "gerald_clark" <[EMAIL PROTECTED]> > To: "Mojtaba Faridzad" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, July 22, 2003 9:15 AM > Subject: Re: how to limit COUNT(*) > > > > Perhaps you c

Re: how to limit COUNT(*)

2003-07-22 Thread Mojtaba Faridzad
.html - Original Message - From: "Mike Brum" <[EMAIL PROTECTED]> To: "'Yves Goergen'" <[EMAIL PROTECTED]>; "'Mojtaba Faridzad'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 10:34 AM Subject: RE: how to l

Re: how to limit COUNT(*)

2003-07-22 Thread Keith C. Ivey
On 22 Jul 2003 at 9:30, gerald_clark wrote: > If you are using MYISAM tables, count(*) does not scan the table to > get the count. That's only true if you have no WHERE clause and thus are counting all the rows in the table. That doesn't seem to be what the original poster is doing. -- Keith

RE: how to limit COUNT(*)

2003-07-22 Thread Mike Brum
PROTECTED] Subject: Re: how to limit COUNT(*) a LIMIT will not work in any case with COUNT since you will always get exactly one row. and what shall a LIMIT 1 on 1 row do here? but you can try the MAX function here: (i guess it exists :) SELECT MAX(COUNT(*), 10001) as numfound FROM mytable WHERE

Re: how to limit COUNT(*)

2003-07-22 Thread gerald_clark
Mojtaba Faridzad wrote: First of all, I don't wanna let the query run to the end and after that, count the number of records. as I mentioned, some tables are huge and takes a long time to run COUNT(*) query for all records. About LIMIT, it doesn't effect on COUNT query. but for the second query

Re: how to limit COUNT(*)

2003-07-22 Thread Yves Goergen
Nachricht- Von: "Mojtaba Faridzad" <[EMAIL PROTECTED]> An: <[EMAIL PROTECTED]> Gesendet: Dienstag, 22. Juli 2003 15:40 Betreff: Re: how to limit COUNT(*) > for example: > > SELECT COUNT(*) as numfound FROM mytable WHERE mycondition; > > in this query, mytabl

Re: how to limit COUNT(*)

2003-07-22 Thread Mojtaba Faridzad
number or other indexes, because the table and conditions are variable and on run-time. - Original Message - From: "Viorel Dragomir" <[EMAIL PROTECTED]> To: "Mojtaba Faridzad" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 9:50 AM

Re: how to limit COUNT(*)

2003-07-22 Thread Viorel Dragomir
- Original Message - From: "Mojtaba Faridzad" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 4:40 PM Subject: Re: how to limit COUNT(*) > for example: > > SELECT COUNT(*) as numfound FROM mytable WHERE mycondition; > > in th

Re: how to limit COUNT(*)

2003-07-22 Thread Mojtaba Faridzad
ROTECTED]> To: "Mojtaba Faridzad" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 9:15 AM Subject: Re: how to limit COUNT(*) > Perhaps you could post some examples of what you have tried. > I don't understand what you are asking. > >

Re: how to limit COUNT(*)

2003-07-22 Thread Jerry
If you are using the result set as part of an application, you could select, then count the rows or use a function such as in PHP : mysql_num_rows() Jerry - Original Message - From: "Mojtaba Faridzad" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 22, 2003 1:08 PM Subjec

Re: how to limit COUNT(*)

2003-07-22 Thread gerald_clark
Perhaps you could post some examples of what you have tried. I don't understand what you are asking. Mojtaba Faridzad wrote: Hi, I guess there is no way to limit COUNT(*). Is that right? We cannot use the result of COUNT in WHERE condition or LIMIT doesn't help. In this case so far I have retriev