public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: Jon Emord <[email protected]>
To: Greg Sabino Mullane <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Poor performance with row wise comparisons
Date: Mon, 10 Feb 2025 13:36:00 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <BLAPR09MB64998C1078D3E84803E10BEECCF12@BLAPR09MB6499.namprd09.prod.outlook.com>
References: <BLAPR09MB64993673A034EE93C6C6F4B6CCF62@BLAPR09MB6499.namprd09.prod.outlook.com>
	<CAKAnmmJDHajWWYx8bMUJRxVHZnLnP0WhEMZD40jeqrZ7aLsFUw@mail.gmail.com>
	<BLAPR09MB64998C1078D3E84803E10BEECCF12@BLAPR09MB6499.namprd09.prod.outlook.com>

On Fri, 2025-02-07 at 16:16 +0000, 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;
>                                                                                           QUERY PLAN
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>  Limit  (cost=0.70..6.37 rows=101 width=31) (actual time=0.094..2712.844 rows=100 loops=1)
>    Buffers: shared hit=97259
>    ->  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_model_id, primary_key) <= ROW(123, 'DEF'::text)))
>          Heap Fetches: 4
>          Buffers: shared hit=97259
>  Planning:
>    Buffers: shared hit=104
>  Planning Time: 0.204 ms
>  Execution Time: 2712.873 ms

How is the index "entity_data_model_id_primary_key_uniq" defined?

Yours,
Laurenz Albe





view thread (8+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Poor performance with row wise comparisons
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox