Crazy query plan.

Поиск
Список
Период
Сортировка
От Oleg Serov
Тема Crazy query plan.
Дата
Msg-id cec7c6df0911130325q3df937cel9cbec500179f7a5a@mail.gmail.com
обсуждение исходный текст
Ответы Re: Crazy query plan.  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-bugs
SQL:
CREATE TABLE test (id BIGINT, id2 BIGINT, id3 BIGINT, id4 BIGINT);
INSERT INTO test SELECT i, i, i, i FROM generate_series(0, 9) i;
EXPLAIN ANALYZE SELECT ((SELECT tmp::test FROM (SELECT * FROM test
LIMIT 1) tmp)::test).*;

WILL:
QUERY PLAN
Result  (cost=0.11..0.12 rows=1 width=0) (actual time=0.076..0.078
rows=1 loops=1)
  InitPlan
    ->  Subquery Scan tmp  (cost=0.00..0.03 rows=1 width=32) (actual
time=0.014..0.019 rows=1 loops=1)
          ->  Limit  (cost=0.00..0.02 rows=1 width=32) (actual
time=0.008..0.009 rows=1 loops=1)
                ->  Seq Scan on test  (cost=0.00..23.10 rows=1310
width=32) (actual time=0.005..0.005 rows=1 loops=1)
    ->  Subquery Scan tmp  (cost=0.00..0.03 rows=1 width=32) (actual
time=0.008..0.013 rows=1 loops=1)
          ->  Limit  (cost=0.00..0.02 rows=1 width=32) (actual
time=0.005..0.006 rows=1 loops=1)
                ->  Seq Scan on test  (cost=0.00..23.10 rows=1310
width=32) (actual time=0.002..0.002 rows=1 loops=1)
    ->  Subquery Scan tmp  (cost=0.00..0.03 rows=1 width=32) (actual
time=0.008..0.012 rows=1 loops=1)
          ->  Limit  (cost=0.00..0.02 rows=1 width=32) (actual
time=0.005..0.006 rows=1 loops=1)
                ->  Seq Scan on test  (cost=0.00..23.10 rows=1310
width=32) (actual time=0.003..0.003 rows=1 loops=1)
    ->  Subquery Scan tmp  (cost=0.00..0.03 rows=1 width=32) (actual
time=0.009..0.013 rows=1 loops=1)
          ->  Limit  (cost=0.00..0.02 rows=1 width=32) (actual
time=0.005..0.006 rows=1 loops=1)
                ->  Seq Scan on test  (cost=0.00..23.10 rows=1310
width=32) (actual time=0.002..0.002 rows=1 loops=1)
Total runtime: 0.138 ms

One subquery for each column. wtf?

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Teodor Sigaev
Дата:
Сообщение: Re: BUG #5183: Wrong select results using multicolumn gin indexes
Следующее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5184: default tablespace owner is not dumped