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

From Cosmin Prund
Subject Re: Bad query plan decision when using multiple column index -postgresql uses only first column then filters
Date
Msg-id CAGU4dz-3XsqExTCdfdzDBocT3dYX4k6ybOp6Su468nfxuXmAsQ@mail.gmail.com
Whole thread Raw
In response to Re: Bad query plan decision when using multiple column index -postgresql uses only first column then filters  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-performance


On Thu, 16 Jan 2020 at 20:20, Laurenz Albe <laurenz.albe@cybertec.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

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bad query plan decision when using multiple column index - postgresql uses only first column then filters
Next
From: Cosmin Prund
Date:
Subject: Re: Bad query plan decision when using multiple column index -postgresql uses only first column then filters