PostgreSQL Choosing Full Index Over Partial Index

2025-04-28 Thread Felipe López Montes
Hi all, I am using PostgreSQL 17.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 12.4.0, 64-bit, and working with the postgres_air Database . I have a very simple query (please forget about the sense of the query itself, I just want to focus on the planne

Re: PostgreSQL Choosing Full Index Over Partial Index

2025-04-28 Thread Laurenz Albe
On Mon, 2025-04-28 at 15:22 +0200, Felipe López Montes wrote: > I am using PostgreSQL 17.4 on x86_64-pc-linux-gnu, compiled by gcc (GCC) > 12.4.0, 64-bit, > and working with the postgres_air Database. > > I have a very simple query (please forget about the sense of the query itself, > I just want

Re: PostgreSQL Choosing Full Index Over Partial Index

2025-04-28 Thread Felipe López Montes
Hi Mr. Laurenz, Thanks a lot for your response :). The full index is bigger as it has an entry for all the rows of the table, whilst the partial one only has entries for canceled flights. Output of pgstatindex() for the *partial index:* version,tree_level,index_size,root_block_no,internal_pages

Re: PostgreSQL Choosing Full Index Over Partial Index

2025-04-28 Thread Tom Lane
Laurenz Albe writes: > On Mon, 2025-04-28 at 15:22 +0200, Felipe López Montes wrote: >> Following the book PostgreSQL Query Optimization (Second Edition), there is a >> statement on page 90 talking about Partial Indexes that says that the planner >> will use the partial index rather than the full