Re: Incorrect cost for MergeAppend
| От | Aleksander Alekseev |
|---|---|
| Тема | Re: Incorrect cost for MergeAppend |
| Дата | |
| Msg-id | CAJ7c6TO=kGaDUj-vsF3Fm-Zog=x7HA2Ai+HS81FHKcyLLQOEFA@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Incorrect cost for MergeAppend (Alexander Kuzmenkov <akuzmenkov@timescale.com>) |
| Список | pgsql-hackers |
Hi,
> Here is a small patch that reproduces the problem on two tables with
> inheritance, and fixes it. I'll add it to the Commitfest.
Thanks for the patch.
I can confirm that it changes the plan from Sort + Append to MergeAppend.
Before:
```
explain (costs off) select * from ma0 where a < 1000 order by a;
QUERY PLAN
---------------------------------------------------------
Sort
Sort Key: ma0.a
-> Append
-> Index Only Scan using ma0_pkey on ma0 ma0_1
Index Cond: (a < 1000)
-> Seq Scan on ma1 ma0_2
Filter: (a < 1000)
```
After:
```
=# explain (costs off) select * from ma0 where a < 1000 order by a;
QUERY PLAN
---------------------------------------------------
Merge Append
Sort Key: ma0.a
-> Index Only Scan using ma0_pkey on ma0 ma0_1
Index Cond: (a < 1000)
-> Sort
Sort Key: ma0_2.a
-> Seq Scan on ma1 ma0_2
Filter: (a < 1000)
```
The rest of the tests pass.
--
Best regards,
Aleksander Alekseev
В списке pgsql-hackers по дате отправления: