Re: Strange execution plan

From: Manuel Weitzman <manuelweitzman(at)gmail(dot)com>
To: Joel Frid <joel(dot)frid(at)car-expresso(dot)com>
Cc: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Strange execution plan
Date: 2021-07-09 02:00:54
Message-ID: EE6D94D6-2F72-4B51-9ACE-750230596A54@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

> On 08-07-2021, at 17:13, Manuel Weitzman <manuelweitzman(at)gmail(dot)com> wrote:
>
> Option A: Use a common table expression to "force" the usage of
> test_json_data_idx
>
> WITH json_matching_rows AS (
> SELECT t.*
> FROM test ti
> WHERE t.json_data @> '{"book":{"title":"In Search of Lost Time"}}'
> )
> SELECT t.*
> FROM json_matching_rows t
> WHERE t."existe" IS true
> ORDER BY t."id" DESC
> LIMIT 100 OFFSET 0;
>

The first query line should be
WITH MATERIALIZED json_matching_rows AS (

I had forgotten that Postgres 12 removed the optimization barrier on
common table expressions.
To introduce it again the MATERIALIZED clause is needed.

Apparently I need to work on reviewing my emails properly before
sending them.

Best regards,
Manuel Weitzman

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Nagaraj Raj 2021-07-09 03:32:46 Re: Partition column should be part of PK
Previous Message Mike Sofen 2021-07-08 23:12:03 RE: Partition column should be part of PK