Skip site navigation (1) Skip section navigation (2)

Re: Optimizer bug??

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: Ismail Kizir <ikizir(at)tumgazeteler(dot)com>
Subject: Re: Optimizer bug??
Date: 2004-05-24 18:40:52
Message-ID: 40B241B4.4090803@bigfoot.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Ismail Kizir wrote:

> Hi everybody,
> 
> 1 .... EXPLAIN SELECT COUNT(*) AS c FROM articletbl WHERE
>       ((mydate BETWEEN '2004-04-24' AND '2004-05-24' )
> )
> 
> 2 .... EXPLAIN SELECT COUNT(*) AS c FROM articletbl WHERE
>       ((mydate = '2004-04-24')
> )
> 
> (I ran VACUUM ANALYZE before running those)
> 
> mydate is an indexed date column.
> The optimizer optimizes the second query but, it doesn't optimize the first
> one and decides to make a "sequential scan".
> Is this a bug?
> Or may someone explain me the reason?

give us the result of these queries:

SELECT COUNT(*) FROM articletbl;

SELECT COUNT(*) AS c FROM articletbl WHERE
mydate BETWEEN '2004-04-24' AND '2004-05-24';

SELECT COUNT(*) AS c FROM articletbl WHERE
mydate = '2004-04-24';



Regards
Gaetano Mendola



In response to

Responses

pgsql-hackers by date

Next:From: Magnus HaganderDate: 2004-05-24 18:46:18
Subject: Re: New horology failure
Previous:From: Gaetano MendolaDate: 2004-05-24 18:37:11
Subject: Re: Big problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group