From: | Hans-Jürgen Schönig <hs(at)cybertec(dot)at> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Execution Plans and Casts |
Date: | 2002-12-26 12:49:30 |
Message-ID: | 3E0AFADA.90205@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Does anybody know how the planner treats casts?
It seems as if casts are not taken into consideration when planning the
query because the costs seem to stay the same.
[hs(at)backup mag]$ psql -p 5400 test -c "EXPLAIN SELECT id FROM t_data1"
QUERY PLAN
-------------------------------------------------------------------
Seq Scan on t_data1 (cost=0.00..168966.00 rows=10000000 width=4)
(1 row)
[hs(at)backup mag]$ psql -p 5400 test -c "EXPLAIN SELECT id::numeric FROM
t_data1"
QUERY PLAN
-------------------------------------------------------------------
Seq Scan on t_data1 (cost=0.00..168966.00 rows=10000000 width=4)
(1 row)
[hs(at)backup mag]$ psql -p 5400 test -c "EXPLAIN SELECT id::text FROM t_data1"
QUERY PLAN
-------------------------------------------------------------------
Seq Scan on t_data1 (cost=0.00..168966.00 rows=10000000 width=4)
(1 row)
[hs(at)backup mag]$ psql -p 5400 test -c "EXPLAIN SELECT COUNT(id::text)
FROM t_data1"
QUERY PLAN
-------------------------------------------------------------------------
Aggregate (cost=193966.00..193966.00 rows=1 width=4)
-> Seq Scan on t_data1 (cost=0.00..168966.00 rows=10000000 width=4)
(2 rows)
[hs(at)backup mag]$ psql -p 5400 test -c "EXPLAIN SELECT COUNT(id) FROM
t_data1"
QUERY PLAN
-------------------------------------------------------------------------
Aggregate (cost=193966.00..193966.00 rows=1 width=4)
-> Seq Scan on t_data1 (cost=0.00..168966.00 rows=10000000 width=4)
(2 rows)
Hans
From | Date | Subject | |
---|---|---|---|
Next Message | dailiming | 2002-12-27 08:29:09 | How can I use cursor in a trigger or function? |
Previous Message | Hans-Jürgen Schönig | 2002-12-26 12:24:12 | CREATE INDEX question |