Re: Column reset all values

Поиск
Список
Период
Сортировка
От Peter J. Holzer
Тема Re: Column reset all values
Дата
Msg-id 20200516104215.GB8152@hjp.at
обсуждение исходный текст
Ответ на Re: Column reset all values  (otar shavadze <oshavadze@gmail.com>)
Список pgsql-general
On 2020-05-14 16:32:41 +0400, otar shavadze wrote:
> also nor index drop is an option, because I need re-create index as I use this
> table in procedure, so index is necessary for  further queries. So total
> runtime will not decreased.

A full index on a column where all the values are the same (NULL in this
case) is useless. For querys which check for the existing value, the
optimizer will notice that a full table scan is faster. For query which
use any other value, you expect 0 results: So all the optimizer want to know is
that the value is indeed not in the column so that it can skip the table
entirely. You can do that with a partial index (WHERE col IS NOT NULL)
or maybe even a constraint.

So I would drop the full index, update the table and then create a
partial index.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Enforcing uniqueness on [real estate/postal] addresses
Следующее
От: RAJAMOHAN
Дата:
Сообщение: Pgpool is crashing when terminating user session