Re: pgstattuple extension for indexes - Mailing list pgsql-patches

From Tom Lane
Subject Re: pgstattuple extension for indexes
Date
Msg-id 2992.1152899042@sss.pgh.pa.us
Whole thread Raw
In response to Re: pgstattuple extension for indexes  (Bruce Momjian <bruce@momjian.us>)
Responses Re: pgstattuple extension for indexes
List pgsql-patches
Bruce Momjian <bruce@momjian.us> writes:
> Patch applied.  Thanks.

>> Also, I added an experimental feature for btree indexes. It checks
>> fragmentation factor of indexes. If an leaf has the right link on the next
>> adjacent page in the file, it is assumed to be continuous (not fragmented).
>> It will help us to decide when to REINDEX.

This was done in an entirely unacceptable way, to wit

    ereport(NOTICE,
        (errmsg("%.2f%% fragmented",
            100.0 * (stat.forward + stat.backward) /
            (stat.continuous + stat.forward + stat.backward)),
        errhint("continuous=%llu, forward=%llu, backward=%llu",
            stat.continuous, stat.forward, stat.backward)));

The really serious problem with reporting this info via NOTICE is that
there's no way for a program to get its hands on the info.  The output
tuple format needs to be extended instead.

The lesser problem that drew my attention is that %llu is unportable
(and in fact draws gcc warnings for me; did you ignore that?).  But
using UINT64_FORMAT instead would create a headache for translation
because the string would vary across platforms.

I won't bother correcting the violations of message style guidelines,
because this code simply has to go away.

            regards, tom lane

pgsql-patches by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Maintenance and External Projects (try 2)
Next
From: Kris Jurka
Date:
Subject: toast index entries again