Unnecessary buffer usage with multicolumn index, row comparison, and equility constraint

2024-05-10 Thread WU Yan
Hi everyone, first time here. Please kindly let me know if this is not the right place to ask. I notice a simple query can read a lot of buffer blocks in a meaningless way, when 1. there is an index scan on a multicolumn index 2. there is row constructor comparison in the Index Cond 3. there is al

Re: Wasteful nested loop join when there is `limit` in the query

2025-02-17 Thread WU Yan
r help! On Mon, 17 Feb 2025 at 18:01, Tom Lane wrote: > WU Yan <4wu...@gmail.com> writes: > > Hello everyone, I am still learning postgres planner and performance > > optimization, so please kindly point out if I missed something obvious. > > An index on employee.na

Wasteful nested loop join when there is `limit` in the query

2025-02-16 Thread WU Yan
Hello everyone, I am still learning postgres planner and performance optimization, so please kindly point out if I missed something obvious. I've noticed that postgres joins all rows in two tables, even though there's a `limit` in the query. It means lots of joined rows are discarded eventually, a