Re: any way to speed up count(*)?
From: Shakespeare <whatsin_at_xs4all.nl>
Date: Thu, 26 Nov 2009 21:20:58 +0100
Message-ID: <4b0ee32b$0$22916$e4fe514c_at_news.xs4all.nl>
Volker Borchert schreef:
> Shakespeare wrote:
>
> Surprisingly, the optimizer sometimes seems to do a bad job about such
> constant clauses. As in "where 1 = 2" resulting in a full table scan...
>
Date: Thu, 26 Nov 2009 21:20:58 +0100
Message-ID: <4b0ee32b$0$22916$e4fe514c_at_news.xs4all.nl>
Volker Borchert schreef:
> Shakespeare wrote:
>> Most times, these queries are generated by some tool that needs a where >> clause anyway, and 'AND's or 'OR's the user specified clauses to it, and >> they put in the 1=1 for when a user does not enter any condition..
>
> Surprisingly, the optimizer sometimes seems to do a bad job about such
> constant clauses. As in "where 1 = 2" resulting in a full table scan...
>
Yep. You never know if somewhere/sometime in your query 1 will become equal to 2..... Better safe than sorry.
Shakespeare Received on Thu Nov 26 2009 - 14:20:58 CST