Partial hash index is not used for implied qual. - Mailing list pgsql-hackers

From Sergei Glukhov
Subject Partial hash index is not used for implied qual.
Date
Msg-id e200bf38-6b45-446a-83fd-48617211feff@postgrespro.ru
Whole thread Raw
Responses Re: Partial hash index is not used for implied qual.
List pgsql-hackers
Hi!

Partial hash index is not used if qual is an implied qual
since this qual is not added to indrestrictinfo and we cannot
get the keys needed to make hash index scan possible.
Suggested fix is to add implied qual for the indexes
which requires the presence of a key to scan the index.

How to repeat:

CREATE TABLE hash_partial(x) AS
        SELECT x as y from generate_series(1, 1000) as x;
ANALYZE hash_partial;
CREATE INDEX partial_idx ON hash_partial USING hash(x) WHERE x = 1;
EXPLAIN (COSTS OFF) SELECT x FROM hash_partial WHERE x = 1;
...
          QUERY PLAN
--------------------------
  Seq Scan on hash_partial
    Filter: (x = 1)
  ...

  Regards,
  Sergei Glukhov


Attachment

pgsql-hackers by date:

Previous
From: Bykov Ivan
Date:
Subject: IPC/MultixactCreation on the Standby server
Next
From: Peter Smith
Date:
Subject: Re: Skipping schema changes in publication