the doc should mention one particular aspect of partial indexes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

the doc should mention one particular aspect of partial indexes

PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/10/sql-vacuum.html
Description:

Hi,

I think the documentation should mention one particular aspect of b-tree
partial indexes:
Say we have a row that satisfy a partial index's predicate. That row will be
referenced by the partial index. Say now that this row gets updated in such
a way that the updated row no longer satisfies the predicate. The entry of
that row in the index (more precisely, the row previous version) is still
kept in a leaf node of the b-tree until a VACUUM is issued on the index's
table.

So in short, an update on the index's predicate column results in no direct
change on the index whereas a change on an index column is reflected as soon
as the change has been committed. I think the documentation should mention
this specificity in some way since it can have impact in terms of index
design. I couldn't find a mention of this behavior anywhere in the doc.

Kind regards,
Chaouki Dhib
Reply | Threaded
Open this post in threaded view
|

Re: the doc should mention one particular aspect of partial indexes

Tom Lane-2
PG Doc comments form <[hidden email]> writes:
> I think the documentation should mention one particular aspect of b-tree
> partial indexes:
> Say we have a row that satisfy a partial index's predicate. That row will be
> referenced by the partial index. Say now that this row gets updated in such
> a way that the updated row no longer satisfies the predicate. The entry of
> that row in the index (more precisely, the row previous version) is still
> kept in a leaf node of the b-tree until a VACUUM is issued on the index's
> table.

How is this different from the behavior for any other dead row version?

                        regards, tom lane


Reply | Threaded
Open this post in threaded view
|

Re: the doc should mention one particular aspect of partial indexes

Chaouki Dhib
I guess it isn't. My apologies. This is something I ignored about PG
until now. Thank you for your reply.


Le lun. 18 janv. 2021 à 21:39, Tom Lane <[hidden email]> a écrit :

>
> PG Doc comments form <[hidden email]> writes:
> > I think the documentation should mention one particular aspect of b-tree
> > partial indexes:
> > Say we have a row that satisfy a partial index's predicate. That row will be
> > referenced by the partial index. Say now that this row gets updated in such
> > a way that the updated row no longer satisfies the predicate. The entry of
> > that row in the index (more precisely, the row previous version) is still
> > kept in a leaf node of the b-tree until a VACUUM is issued on the index's
> > table.
>
> How is this different from the behavior for any other dead row version?
>
>                         regards, tom lane