Skip to content

Instantly share code, notes, and snippets.

@ioguix
Last active March 28, 2018 18:12
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ioguix/c29d5790b8b93bf81c27 to your computer and use it in GitHub Desktop.
Save ioguix/c29d5790b8b93bf81c27 to your computer and use it in GitHub Desktop.
B-tree index bloat estimation
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@darkixion
Copy link

The bloat for pg_operator on a database I just looked at returned -80 as the bloat ratio with this query.

@ioguix
Copy link
Author

ioguix commented Oct 8, 2014

Hi darkixion,

Sorry for the late answer, I never noticed your comment.

As explained in my various blog posts, this table is using the "name" type, leading to really bad estimations. You have to filter out indexes that we can not have a good estimation using the "is_na" field.

See "Known bug" in http://blog.ioguix.net/postgresql/2014/06/24/More-work-on-index-bloat-estimation-query.html

I should add links to my blog posts as documentation or put these queries in a repository with a proper README at some point...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment