From: | "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Column reset all values |
Date: | 2020-05-16 10:42:15 |
Message-ID: | 20200516104215.GB8152@hjp.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
From | Date | Subject | |
---|---|---|---|
Next Message | RAJAMOHAN | 2020-05-16 11:20:05 | Pgpool is crashing when terminating user session |
Previous Message | Peter J. Holzer | 2020-05-16 10:01:11 | Re: Enforcing uniqueness on [real estate/postal] addresses |