Re: Poor performance with row wise comparisons

2025-02-10 Thread Laurenz Albe
On Fri, 2025-02-07 at 16:16 +, Jon Emord wrote: > explain (analyze, buffers) > select data_model_id, primary_key > from entity > WHERE (data_model_id, primary_key) BETWEEN (123, ‘ABC’) AND (123, ‘DEF’)  > limit 101; >                                                                              

Re: Poor performance with row wise comparisons

2025-02-09 Thread Tom Lane
Jon Emord writes: >-> Index Only Scan using entity_data_model_id_primary_key_uniq on entity > (cost=0.70..873753.60 rows=15581254 width=31) (actual time=0.093..2712.836 > rows=100 loops=1) > Index Cond: ((ROW(data_model_id, primary_key) >= ROW(123, > 'ABC'::text)) AND (ROW(data_m

Re: Poor performance with row wise comparisons

2025-02-09 Thread Jon Emord
From: Greg Sabino Mullane Sent: Friday, February 7, 2025 9:43 AM To: Jon Emord Cc: pgsql-performance@lists.postgresql.org Subject: Re: Poor performance with row wise comparisons You don't often get email from htamf...@gmail.com. Learn why this is important<https://aka.ms/LearnAbou

Re: Poor performance with row wise comparisons

2025-02-07 Thread Greg Sabino Mullane
On Fri, Feb 7, 2025 at 2:05 AM Jon Emord wrote: > but with limit 101, the extra shared hits return > Can you show the explain analyze for the limit 101 case? Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support

Poor performance with row wise comparisons

2025-02-06 Thread Jon Emord
Hi everyone I wrote a query to iterate over two different columns. These columns have a composite unique index on them, and I’m only retrieving those columns. I found that there was a very large difference in performance when using row wise comparison versus a column comparison. The column comp