Re: BTREE index: field ordering

2025-03-29 Thread Kevin Stephenson
? You currently have "tipo" in second place in your candidate index. Thanks, Kevin From: Moreno Andreo Sent: Friday, March 28, 2025 5:38 AM To: PostgreSQL mailing lists Subject: BTREE index: field ordering Hi, Postgres 16.4 (planning to go on 17.4) I&#x

Re: BTREE index: field ordering

2025-03-28 Thread David G. Johnston
On Fri, Mar 28, 2025 at 9:24 AM Ron Johnson wrote: > > "at least for WHERE conditions that are selective" confuses me. Aren't > _all_ WHERE clauses selective? > > >From earlier in the email, selectivity is a scale, the wording here implies "has a meaningful selectivity". "Fundamentally yes, but

Re: BTREE index: field ordering

2025-03-28 Thread David G. Johnston
On Fri, Mar 28, 2025 at 10:02 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > Selectivity is evaluating cardinality with an eye on the frequency of > the values you are actually going to be filtering on. So low cardinality > booleans can be highly selective in usage if you are looking

Re: BTREE index: field ordering

2025-03-28 Thread Ron Johnson
On Fri, Mar 28, 2025 at 9:35 AM Laurenz Albe wrote: > On Fri, 2025-03-28 at 13:38 +0100, Moreno Andreo wrote: > > Postgres 16.4 (planning to go on 17.4) > > I'm creating some indexes based on some slow query reported by logs. > > These queries involve a WHERE with more than 5 fields, that are

Re: BTREE index: field ordering

2025-03-28 Thread Laurenz Albe
On Fri, 2025-03-28 at 13:38 +0100, Moreno Andreo wrote: >  Postgres 16.4 (planning to go on 17.4) >  I'm creating some indexes based on some slow query reported by logs. >  These queries involve a WHERE with more than 5 fields, that are matching by > =, <>, LIKE and IN() >  I read that equality

BTREE index: field ordering

2025-03-28 Thread Moreno Andreo
Hi, Postgres 16.4 (planning to go on 17.4) I'm creating some indexes based on some slow query reported by logs. These queries involve a WHERE with more than 5 fields, that are matching by =, <>, LIKE and IN() I read that equality fields must be first, then the others. Is it correct? Based on th