Query Optimizer does not ignore constant condition?
From: hemal <h00_at_hotmail.com>
Date: 20 Aug 2003 15:06:19 -0700
Message-ID: <16c83c3f.0308201406.29b9f79d_at_posting.google.com>
Date: 20 Aug 2003 15:06:19 -0700
Message-ID: <16c83c3f.0308201406.29b9f79d_at_posting.google.com>
I came across a very strange situation at work. There is an order of
magnitude difference in execution time for the following two queries
(10 v/s ~130 msec):
select count(*) from table_name where column_name = 'value' or 1 = 0
select count(*) from table_name where column_name = 'value'
I do not want to go into the reason why the redundent condition
exists, the example is representative of the real query where it
serves a purpose.
Any suggestions what I can do to improve the situation?
Thanks in advance.