Martijn van Oosterhout <kleptog@svana.org> writes:
> Which could then be used by the planner. Or more directly:
>
> CREATE HISTOGRAM FOR FUNCTION verify_pk_signature(documenent)
> AS ( true = 99, false = 1 );
>
> (Perhaps DECLARE is the better phrase?).
Except that the distribution is a property of the values you're passing it,
not the function itself. In theory verify_pk_signature() returns false for
99.999...% of its inputs. But of course unless you have a black hat or
hardware problems you're not going to ever pass it any input that makes it
return false.
The query may be a routine session cookie check where it will virtually always
return true, or it may be a DBA running an ad-hoc query to check suspicious
records for invalid data. It may even be the same query from the same object
method being called from different call sites in the application.
I'm not saying the above isn't a good idea though. I rather like it actually.
But the point of my example originally was specifically to show how at least
sometimes the *only* place the knowledge of the data distribution lies is in
the programmer's head.
--
greg