Received: from flex.flex.ro (IDENT:root@[193.230.255.4]) by hub.org (8.9.3/8.9.3) with ESMTP id IAA21839 for ; Wed, 14 Jul 1999 08:13:52 -0400 (EDT) (envelope-from teo@flex.ro) Received: from flex.ro (IDENT:teo@teo.flex.ro [193.230.255.3]) by flex.flex.ro (8.9.3/8.9.3) with ESMTP id PAA00515; Wed, 14 Jul 1999 15:11:32 +0300 Sender: teo@flex.flex.ro Message-ID: <378C7FF7.D2334A21@flex.ro> Date: Wed, 14 Jul 1999 12:17:59 +0000 From: Constantin Teodorescu Organization: FLEX Consulting X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.9 i586) X-Accept-Language: en MIME-Version: 1.0 To: Hannu Krosing CC: "pgsql-hackers@postgreSQL.org" Subject: Re: [HACKERS] Interesting behaviour ! References: <378C394C.3487DBAC@flex.ro> <378C662A.B3FFD088@trust.ee> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hannu Krosing wrote: > > You may try : > > explain select * from note where perioada=15::int2; > > i think that the default for 'untyped' numbers is int4 and > this currently confuses the optimiser. You are right! Thanks a lot! Watch this! contabil=> explain select * from note where perioada=29::int2; NOTICE: QUERY PLAN: Index Scan using note_perioada on note (cost=108.96 rows=1600 width=87) EXPLAIN contabil=> explain select * from note where perioada=29; NOTICE: QUERY PLAN: Seq Scan on note (cost=1099.99 rows=1600 width=87) My queries are faster now! I think that this thing should be fixed. You need more than common SQL in order to optimize your queries. That conversions should be automatically assumed by the query optimizer in order to deliver real performances. I don't know how difficult that would be. Thanks a lot, Best regards, -- Constantin Teodorescu FLEX Consulting Braila, ROMANIA