Re: Proposal: Global Index for PostgreSQL
От | Amit Langote |
---|---|
Тема | Re: Proposal: Global Index for PostgreSQL |
Дата | |
Msg-id | CA+HiwqG+Eizej9nCNcxSOfFyZ2i9Mhv=zn+a+4o-gwsvFz6EqQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Proposal: Global Index for PostgreSQL (Dilip Kumar <dilipbalaut@gmail.com>) |
Ответы |
Re: Proposal: Global Index for PostgreSQL
|
Список | pgsql-hackers |
Hi Dilip, Happy to see you working on this. It’s clear a lot of thought has gone into the design. On Tue, Jul 1, 2025 at 6:27 PM Dilip Kumar <dilipbalaut@gmail.com> wrote: > 6) Need to perform a performance test, for SELECT/UPDATE/INSERT cases, > we already know the VACUUM performance. One point I want to check my understanding of is around the locking implications of global index scans, especially in prepared statement scenarios. I’ve been working on improving how we handle partition locking during execution of generic plans. Specifically, I committed a patch to defer locking of partitions until after pruning during ExecutorStart(), so we avoid taking locks on partitions that aren’t actually needed -- even when the plan contains scans on all partitions. That patch was later reverted, as Tom pointed out that the plan invalidation logic wasn't cleanly handled. But the goal remains: to avoid locking unnecessary partitions, particularly in high-partition-count OLTP setups that use PREPARE/EXECUTE. The proposed global index design, IIUC, requires locking all leaf partitions up front during planning, and I guess during AcquireExecutorLocks() when using a cached plan, because the index scan could return tuples from any partition. This seems to directly undercut that effort: we'd be back to generic plans causing broad locking regardless of actual runtime needs. I understand that this is currently necessary, given that a global index scan is a single node without per-partition awareness. But it might be worth considering whether the scan could opportunistically defer heap relation locking until it returns a tuple that actually belongs to a particular partition -- similar to how inserts into partitioned tables only lock the target partition at execution time. Or did I miss that inserts also need to lock all partitions up front when global indexes are present, due to cross-partition uniqueness checks? Let me know if I’ve misunderstood the design. -- Thanks, Amit Langote
В списке pgsql-hackers по дате отправления: