Re: [PoC] Reducing planning time when tables have many partitions
От | David Rowley |
---|---|
Тема | Re: [PoC] Reducing planning time when tables have many partitions |
Дата | |
Msg-id | CAApHDvowVzvB2QdLKEPUTFBERuJjox2ZCuHQo4sieR5yvmmHpw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [PoC] Reducing planning time when tables have many partitions (Yuya Watari <watari.yuya@gmail.com>) |
Ответы |
Re: [PoC] Reducing planning time when tables have many partitions
|
Список | pgsql-hackers |
On Wed, 27 Jul 2022 at 18:07, Yuya Watari <watari.yuya@gmail.com> wrote: > I agree that introducing a Bitmapset field may solve this problem. I > will try this approach in addition to previous ones. I've attached a very half-done patch that might help you get started on this. There are still 2 failing regression tests which seem to be due to plan changes. I didn't expend any effort looking into why these plans changed. The attached does not contain any actual optimizations to find the minimal set of EMs to loop through by masking the Bitmapsets that I mentioned in my post last night. I just quickly put it together to see if there's some hole in the idea. I don't think there is. I've not really considered all of the places that we'll want to do the bit twiddling to get the minimal set of EquivalenceMember. I did see there's a couple more functions in postgres_fdw.c that could be optimized. One thing I've only partially thought about is what if you want to also find EquivalenceMembers with a constant value. If there's a Const, then you'll lose the bit for that when you mask the ec's ec_member_indexes with the RelOptInfos. If there are some places where we need to keep those then I think we'll need to add another field to EquivalenceClass to mark the index into PlannerInfo's eq_members for the EquivalenceMember with the Const. That bit would have to be bms_add_member()ed back into the Bitmapset of matching EquivalenceMembers after masking out RelOptInfo's ec_member_indexes. When adding the optimizations to find the minimal set of EM bits to search through, you should likely add some functions similar to the get_eclass_indexes_for_relids() and get_common_eclass_indexes() functions to help you find the minimal set of bits. You can also probably get some other inspiration from [1], in general. David [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=3373c715535
Вложения
В списке pgsql-hackers по дате отправления: