Re: Export user visible function to make use of convert_to_scalar

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Export user visible function to make use of convert_to_scalar
Date: 2007-07-31 20:19:10
Message-ID: 6127.1185913150@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> How so? The entries in the histogram are equidistant by definition.

> Huh? They have equal number of values between them, they're not equidistant in
> the scalar space. So the area of each bar should be the same but the width
> would be proportional to the width of the bucket and the height inversely
> proportional.

You're presuming there exists a linear scalar space to reference the
results to. I'm unconvinced that that's a good assumption to make.
Consider for instance a column of URLs; practically all the entries will
start with http or ftp or one of a small number of other possibilities.
If you try to represent this with some hypothetical linear x-axis you
are going to produce an unusable display.

convert_to_scalar partially avoids this problem because of the way it's
used within the backend: we don't actually assume that there is any
global linear space, only that the values within any single histogram
bucket are fairly uniformly distributed. (This assumption tends to
become true in the limit as the buckets get smaller, even if the global
distribution is pretty crazy. And even if it doesn't become true, the
absolute error is bounded by the bucket size.) You can't use the thing
to measure the "positions" of histogram boundary values, because those
are part of its frame of reference not something it outputs.

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2007-07-31 23:08:12 Re: Export user visible function to make use of convert_to_scalar
Previous Message Gregory Stark 2007-07-31 19:09:56 Re: Export user visible function to make use of convert_to_scalar