Re: Index bloat and REINDEX/VACUUM optimization for partial index

From: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: jayaprabhakar k <jayaprabhakar(at)gmail(dot)com>, psql-performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Index bloat and REINDEX/VACUUM optimization for partial index
Date: 2023-09-01 18:01:26
Message-ID: CAK-MWwRSDUdonwXVz-cryfdX5h64oqswbu34CymWiovsFfJ1Zg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>
> But anyway, PostgreSQL has features to prevent the index bloat from
> becoming too severe of a problem, and you should figure out why they are
> not working for you. The most common ones I know of are 1) long open
> snapshots preventing clean up, 2) all index scans being bitmap index scans,
> which don't to micro-vacuuming/index hinting the way ordinary btree
> index scans do, and 3) running the queries on a hot-standby, where index
> hint bits must be ignored. If you could identify and solve this issue,
> then you wouldn't need to twist yourself into knots avoiding non-HOT
> updates.
>

I am not sure that kill bits could be a complete fix for indexes with tens
of millions dead entries and only a handful of live entries. As I
understand the mechanics of killbits - they help to avoid excessive heap
visibility checks for dead tuples, but tuples with killbit are still should
be read from the index first. And with many millions of dead entries it
isn't free.

PS: ignoring killbits on hot standby slaves is a source of endless pain in
many cases.

--
Maxim Boguk
Senior Postgresql DBA

Phone UA: +380 99 143 0000
Phone AU: +61 45 218 5678

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message James Pang (chaolpan) 2023-09-06 01:34:05 query pg_stat_ssl hang 100%cpu
Previous Message Rondat Flyag 2023-09-01 13:45:06 Re: Queries containing ORDER BY and LIMIT started to work slowly