Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters

From: Cosmin Prund <cprund(at)gmail(dot)com>
To: Pgsql Performance <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
Date: 2020-01-16 19:06:38
Message-ID: CAGU4dz-3XsqExTCdfdzDBocT3dYX4k6ybOp6Su468nfxuXmAsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 16 Jan 2020 at 20:20, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:

> Well, what should the poor thing do?
> There is no index on "LucrareBugetDateId".
>

I did add an index on "LucrareBugetDateId" (before accidentally "fixing"
the problem with ANALYZE) and it didn't help.

> Rather, you have two indexes on ("LucrareBugetVersiuneId",
> "LucrareBugetDateId"),
> one of which should be dropped.
>

One will be dropped. The second one was added out of desperation (because
it wasn't using the first one).

> Try with an index on "LucrareBugetDateId".
>
> Yours,
> Laurenz Albe
> --
> Cybertec | https://www.cybertec-postgresql.com
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Cosmin Prund 2020-01-16 19:52:15 Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
Previous Message Tom Lane 2020-01-16 18:55:49 Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters