Re: Index creation

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Дмитрий Иванов <firstdismay(at)gmail(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Index creation
Date: 2022-06-20 18:23:40
Message-ID: CAMkU=1z8C17d0KLX4ioz6u+k6UndyA7oFeNrMUQZzjSR=152zw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jun 20, 2022 at 1:17 AM Дмитрий Иванов <firstdismay(at)gmail(dot)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

>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2022-06-20 20:31:21 Re: A error happend when I am clone the git repository
Previous Message Mahendrakar, Prabhakar - Dell Team 2022-06-20 10:51:49 RE: Postgresql error : PANIC: could not locate a valid checkpoint record