Alvaro, For the query : EXPLAIN SELECT count(tarih) AS c FROM articletbl WHERE sitekodu = 12 AND ((tarih>='2004-04-24' AND tarih<'2004-05-24' ))
QUERY PLAN is Aggregate (cost=41619.34..41619.34 rows=1 width=4) -> Seq Scan on articletbl (cost=0.00..41618.46 rows=353 width=4) Filter: ((sitekodu = 12) AND (tarih >= '2004-04-24'::date) AND (tarih < '2004-05-24'::date)) And for the query : EXPLAIN SELECT count(tarih) AS c FROM articletbl WHERE sitekodu = 12 AND ((tarih>='2004-05-10' AND tarih<'2004-05-24' )) QUERY PLAN Aggregate (cost=20279.72..20279.72 rows=1 width=4) -> Index Scan using ind_articletbltrh on articletbl (cost=0.00..20279.40 rows=127 width=4) Index Cond: ((tarih >= '2004-05-10'::date) AND (tarih < '2004-05-24'::date)) Filter: (sitekodu = 12) Have you got an idea? Thanks in advance Ismail Kizir ----- Original Message ----- From: "Alvaro Herrera" <[EMAIL PROTECTED]> To: "Ismail Kizir" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, May 24, 2004 9:23 PM Subject: Re: [HACKERS] Optimizer bug?? > On Mon, May 24, 2004 at 08:27:01PM +0300, Ismail Kizir wrote: > > > The optimizer does an indexed scan up to 20 days, and then, it decides to > > make a sequential scan. > > But i am still not sure about the efficiency of this decision. > > Huh, so what was the EXPLAIN ANALYZE of the query with BETWEEN? > > -- > Alvaro Herrera (<alvherre[a]dcc.uchile.cl>) > Syntax error: function hell() needs an argument. > Please choose what hell you want to involve. > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) > > ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match