Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 957E04773B2 for ; Fri, 17 Jan 2003 10:09:28 -0500 (EST) Received: from mail.sarkor.com (unknown [81.95.224.36]) by postgresql.org (Postfix) with SMTP id 46FDA4772E0 for ; Fri, 17 Jan 2003 10:08:04 -0500 (EST) Received: (qmail 30518 invoked by uid 507); 17 Jan 2003 15:08:04 -0000 Received: from thor@sarkor.com by mail.sarkor.com by uid 504 with qmail-scanner-1.14 (clamscan: 0.51. Clear:. Processed in 0.814302 secs); 17 Jan 2003 15:08:04 -0000 Received: from unknown (HELO timur) (81.95.224.66) by mail.sarkor.com with SMTP; 17 Jan 2003 15:08:03 -0000 Date: Fri, 17 Jan 2003 20:08:14 +0500 From: Timur Irmatov X-Mailer: The Bat! (v1.61) Reply-To: Timur Irmatov X-Priority: 3 (Normal) Message-ID: <87109443711.20030117200814@sarkor.com> To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: index usage In-Reply-To: <11751.1042815424@sss.pgh.pa.us> References: <10597430257.20030117164800@sarkor.com> <11751.1042815424@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/179 X-Sequence-Number: 826 TL> Timur Irmatov writes: >> Limit (cost=0.00..0.19 rows=1 width=6) (actual time=0.43..0.43 rows=0 loops=1) >> -> Index Scan using timeindex on mediumstats (cost=0.00..2898.96 rows=15185 width=6) (actual time=0.42..0.42 rows=0 loops=1) TL> The planner has absolutely no clue about the behavior of your function, TL> and so its estimate of the number of rows matched is way off, leading to TL> a poor estimate of the cost of an indexscan. There is not much to be TL> done about this in the current system (though I've speculated about the TL> possibility of computing statistics for functional indexes). you're absolutely right. thanks. TL> Just out of curiosity, why don't you lose all this year/month/day stuff TL> and use a timestamp column? Less space, more functionality. :-) Well, I've a seen a lot of people on pgsql-general mailing list with problems with dates, timestamps, and I was just scared of using PostreSQL date and time types and functions.. May be, I should just try it myself before doing it other way...