Re: Index creation - Mailing list pgsql-general

From Jeff Janes
Subject Re: Index creation
Date
Msg-id CAMkU=1z8C17d0KLX4ioz6u+k6UndyA7oFeNrMUQZzjSR=152zw@mail.gmail.com
Whole thread Raw
In response to Re: Index creation  (Дмитрий Иванов <firstdismay@gmail.com>)
Responses Re: Index creation
List pgsql-general
On Mon, Jun 20, 2022 at 1:17 AM Дмитрий Иванов <firstdismay@gmail.com> wrote:
Your statement seems obvious to me. But what I see doesn't seem like a conscious choice. It turns out that it is better to have a lighter general-purpose index than to strive to create a target covering index for a certain kind of operation.

If both indexes are expected to be hit only once in the query and return only one row, their expected costs will be the same.  In this case, the tie is broken arbitrarily, and that often means the most-recently created index will get chosen.

As the expected number of leaf page accesses in a given query goes up, the smaller index will start to look less expensive.

Cheers,

Jeff 

pgsql-general by date:

Previous
From: "Mahendrakar, Prabhakar - Dell Team"
Date:
Subject: RE: Postgresql error : PANIC: could not locate a valid checkpoint record
Next
From: Magnus Hagander
Date:
Subject: Re: A error happend when I am clone the git repository