From: | Tatsuhito Kasahara <kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp> |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: BUG #4170: Rows estimation which are cast from TEXT is inaccurate. |
Date: | 2008-05-16 07:32:33 |
Message-ID: | 482D3891.9020809@oss.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi.
Tom Lane wrote:
> "Tashuhito Kasahara" <kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp> writes:
>> test=# EXPLAIN SELECT * FROM test WHERE t < '2008-05-14
>> 23:55:00'::text::timestamp;
>> QUERY PLAN
>> ----------------------------------------------------------------------------
>
>> Seq Scan on test (cost=0.00..2209.00 rows=32133 width=12) <- too little
>> number of the estimates
>> Filter: (t < ('2008-05-14 23:55:00'::text)::timestamp without time zone)
>> (2 rows)
>
> Hmm ... as of 8.3 this will generate a CoerceViaIO node, and it looks
> like I forgot to teach eval_const_expressions how to simplify those.
Relevant issues ocurred on PostgreSQL versions 7.4 also.
8.2, 8.1 and 8.0 seemed to be accurate estimates on simple test.
============= 7.4
test=# EXPLAIN ANALYZE SELECT * FROM test WHERE id < '2008-5-14 00:01:00'::text::timestamp;
QUERY PLAN
-----------------------------------------------------------------------------------------------------
Seq Scan on test (cost=0.00..224.98 rows=3667 width=8) (actual time=0.026..30.987 rows=60 loops=1)
Filter: (id < ('2008-5-14 00:01:00'::text)::timestamp without time zone)
Total runtime: 31.074 ms
(3 rows)
============= 8.2
test=# EXPLAIN ANALYZE SELECT * FROM test WHERE id < '2008-5-14 00:01:00'::text::timestamp;
QUERY PLAN
---------------------------------------------------------------------------------------------------
Seq Scan on test (cost=0.00..224.98 rows=55 width=8) (actual time=0.043..13.896 rows=60 loops=1)
Filter: (id < ('2008-5-14 00:01:00'::text)::timestamp without time zone)
Total runtime: 13.951 ms
(3 rows)
============= 8.1
test=# EXPLAIN ANALYZE SELECT * FROM test WHERE id < '2008-5-14 00:01:00'::text::timestamp;
QUERY PLAN
---------------------------------------------------------------------------------------------------
Seq Scan on test (cost=0.00..224.98 rows=60 width=8) (actual time=0.034..15.409 rows=60 loops=1)
Filter: (id < ('2008-5-14 00:01:00'::text)::timestamp without time zone)
Total runtime: 15.464 ms
(3 rows)
============= 8.0
test=# EXPLAIN ANALYZE SELECT * FROM test WHERE id < '2008-5-14 00:01:00'::text::timestamp;
QUERY PLAN
---------------------------------------------------------------------------------------------------
Seq Scan on test (cost=0.00..224.98 rows=63 width=8) (actual time=0.041..18.645 rows=60 loops=1)
Filter: (id < ('2008-5-14 00:01:00'::text)::timestamp without time zone)
Total runtime: 18.706 ms
(3 rows)
=============
Best regards.
--
Tatsuhito Kasahara
kasahara(dot)tatsuhito(at)oss(dot)ntt(dot)co(dot)jp
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Männl | 2008-05-16 09:54:16 | A Fix for a bug? |
Previous Message | shohorab hossain | 2008-05-16 01:49:21 | Re: [DOCS] problem in installing pgsql-8.3.1 |