Re: Suppressing unused subquery output columns
От | Rod Taylor |
---|---|
Тема | Re: Suppressing unused subquery output columns |
Дата | |
Msg-id | CAKddOFAKSL-FU8yC-AXOxH8XNF-y1C-LAoJv8_RK3-kY=0j8Eg@mail.gmail.com обсуждение исходный текст |
Ответ на | Suppressing unused subquery output columns (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Suppressing unused subquery output columns
|
Список | pgsql-hackers |
On Thu, Jun 5, 2014 at 10:27 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I'm not entirely convinced that it's worth the extra planning cycles,
though. Given the small number of complaints to date, it might not
be worth doing this. Thoughts?
Would this avoid execution of expensive functions in views when their output is discarded?
-- On 9.3
CREATE TABLE data (col1 serial primary key);
INSERT INTO data DEFAULT VALUES;
INSERT INTO data DEFAULT VALUES;
CREATE OR REPLACE VIEW v AS select *, (pg_sleep(1))::text FROM data;
t=# explain analyze select col1 from v;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------
Subquery Scan on v (cost=0.00..76.00 rows=2400 width=4) (actual time=1001.086..2002.217 rows=2 loops=1)
-> Seq Scan on data (cost=0.00..52.00 rows=2400 width=4) (actual time=1001.083..2002.210 rows=2 loops=1)
Total runtime: 2002.268 ms
(3 rows)
CREATE TABLE data (col1 serial primary key);
INSERT INTO data DEFAULT VALUES;
INSERT INTO data DEFAULT VALUES;
CREATE OR REPLACE VIEW v AS select *, (pg_sleep(1))::text FROM data;
t=# explain analyze select col1 from v;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------
Subquery Scan on v (cost=0.00..76.00 rows=2400 width=4) (actual time=1001.086..2002.217 rows=2 loops=1)
-> Seq Scan on data (cost=0.00..52.00 rows=2400 width=4) (actual time=1001.083..2002.210 rows=2 loops=1)
Total runtime: 2002.268 ms
(3 rows)
regards,
Rod
Rod
В списке pgsql-hackers по дате отправления: