From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jehan-Guillaume de Rorthais <ioguix(at)free(dot)fr> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Strange avg value size for index on expression in pg_stats |
Date: | 2014-11-10 14:39:23 |
Message-ID: | 24416.1415630363@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Jehan-Guillaume de Rorthais <ioguix(at)free(dot)fr> writes:
> While investigating about a wrong result with my btree bloat estimation query,
> I found a strange stat deviation between the average size of a value in its
> table and its average size in one index on the "lower" expression.
ANALYZE doesn't look at the physical index at all. For an expression
index, it will recompute the index expression at each sampled row, and
then take statistics on those values. In the case you've got here, it's
re-running the lower() function and looking at the uncompressed result.
So that accounts for the discrepancy in average width stats.
> This tiny difference is the source of a very bad estimation with the
> Btree bloat estimation query when values are around an alignement
> boundary.
TBH, if that query is relying on ANALYZE width estimates to be accurate
to the last byte, its reliability is going to be horrid anyway.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Jehan-Guillaume de Rorthais | 2014-11-10 15:41:11 | Re: Strange avg value size for index on expression in pg_stats |
Previous Message | Adrian Klaver | 2014-11-10 14:35:28 | Re: Strange result using pg_dump gzip or split. |