
On Wed, Jan 28, 2009 at 09:54:35AM -0500, dariuszs wrote:
Hi, Could you please help me with this query? I've got gender field in the table1 with values 'Female', 'Male', 'Unknown' sql1: select gender,count(*) from table1 group by gender returns results in 2 seconds sql2: select gender,count(*) from table where gender in ('Female','Male') group by gender returns results in 20 seconds
Why the second query took longer when I'm selecting less values? Thanks.
a) Because your request grouging in the second case, but not in the first case, i.e., more complex query => more time. b) How many less tuples do you get in the second case, i.e., how many tuples are there in total, and how many of them have "unkown" gender? Stefan
Dariusz.
------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users
-- | Dr. Stefan Manegold | mailto:Stefan.Manegold@cwi.nl | | CWI, P.O.Box 94079 | http://www.cwi.nl/~manegold/ | | 1090 GB Amsterdam | Tel.: +31 (20) 592-4212 | | The Netherlands | Fax : +31 (20) 592-4312 |