Re: [PoC] Reducing planning time when tables have many partitions
Yuya Watari <watari.yuya@gmail.com>
From: Yuya Watari <watari.yuya@gmail.com>
To: Alena Rybakina <lena.ribackina@yandex.ru>
Cc: Andrei Lepikhov <a.lepikhov@postgrespro.ru>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>,
David Rowley <dgrowleyml@gmail.com>, Thom Brown <thom@linux.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Zhang Mingli <zmlpostgres@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2024-02-28T11:18:18Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Update wording in optimizer/README for EquivalenceClasses
- d7c04db27aeb 18.0 landed
-
Speedup child EquivalenceMember lookup in planner
- d69d45a5a956 18.0 landed
-
Allow planner to use Merge Append to efficiently implement UNION
- 66c0185a3d14 17.0 cited
-
Remove trailing zero words from Bitmapsets
- a8c09daa8bb1 17.0 cited
-
Make Vars be outer-join-aware.
- 2489d76c4906 16.0 cited
-
Avoid making commutatively-duplicate clauses in EquivalenceClasses.
- a5fc46414deb 16.0 cited
Attachments
- v24-0001-Speed-up-searches-for-child-EquivalenceMembers.patch (application/octet-stream) patch v24-0001
- v24-0002-Introduce-indexes-for-RestrictInfo.patch (application/octet-stream) patch v24-0002
- v24-0003-Move-EquivalenceClass-indexes-to-PlannerInfo.patch (application/octet-stream) patch v24-0003
Hello, On Tue, Feb 13, 2024 at 6:19 AM Alena Rybakina <lena.ribackina@yandex.ru> wrote: > > Yes, it is working correctly now with the assertion check. I suppose > it's better to add this code with an additional comment and a > recommendation for other developers > to use it for checking in case of manipulations with the list of > equivalences. Thank you for your reply and advice. I have added this assertion so that other developers can use it in the future. I also merged recent changes and attached a new version, v24. Since this thread is getting long, I will summarize the patches. 1. v24-0001 This patch is one of the main parts of my optimization. Traditionally, EquivalenceClass has both parent and child members. However, this leads to high iteration costs when there are many child partitions. In v24-0001, EquivalenceClasses no longer have child members. If we need to iterate over child EquivalenceMembers, we use the EquivalenceChildMemberIterator and access the children through the iterator. For more details, see [1] (please note that there are a few design changes from [1]). 2. v24-0002 This patch was made in the previous work with David. Like EquivalenceClass, there are many RestrictInfos in highly partitioned cases. This patch introduces an indexing mechanism to speed up searches for RestrictInfos. 3. v24-0003 v24-0002 adds its indexes to RangeTblEntry, but this is not a good idea. RelOptInfo is the best place. This problem is a workaround because some RelOptInfos can be NULL, so we cannot store indexes to such RelOptInfos. v24-0003 moves the indexes from RangeTblEntry to PlannerInfo. This is still a workaround, and I think it should be reconsidered. [1] https://www.postgresql.org/message-id/CAJ2pMkZk-Nr%3DyCKrGfGLu35gK-D179QPyxaqtJMUkO86y1NmSA%40mail.gmail.com -- Best regards, Yuya Watari