<s>
Histograms	B-Algorithm
are	O
most	O
commonly	O
used	O
as	O
visual	O
representations	O
of	O
data	O
.	O
</s>
<s>
However	O
,	O
Database	B-Application
systems	I-Application
use	O
histograms	B-Algorithm
to	O
summarize	O
data	O
internally	O
and	O
provide	O
size	O
estimates	O
for	O
queries	B-Language
.	O
</s>
<s>
These	O
histograms	B-Algorithm
are	O
not	O
presented	O
to	O
users	O
or	O
displayed	O
visually	O
,	O
so	O
a	O
wider	O
range	O
of	O
options	O
are	O
available	O
for	O
their	O
construction	O
.	O
</s>
<s>
Simple	O
or	O
exotic	O
histograms	B-Algorithm
are	O
defined	O
by	O
four	O
parameters	O
,	O
Sort	O
Value	O
,	O
Source	O
Value	O
,	O
Partition	O
Class	O
and	O
Partition	O
Rule	O
.	O
</s>
<s>
The	O
most	O
basic	O
histogram	B-Algorithm
is	O
the	O
equi-width	O
histogram	B-Algorithm
,	O
where	O
each	O
bucket	O
represents	O
the	O
same	O
range	O
of	O
values	O
.	O
</s>
<s>
That	O
histogram	B-Algorithm
would	O
be	O
defined	O
as	O
having	O
a	O
Sort	O
Value	O
of	O
Value	O
,	O
a	O
Source	O
Value	O
of	O
Frequency	O
,	O
be	O
in	O
the	O
Serial	O
Partition	O
Class	O
and	O
have	O
a	O
Partition	O
Rule	O
stating	O
that	O
all	O
buckets	O
have	O
the	O
same	O
range	O
.	O
</s>
<s>
V-optimal	B-Application
histograms	I-Application
are	O
an	O
example	O
of	O
a	O
more	O
"	O
exotic	O
"	O
histogram	B-Algorithm
.	O
</s>
<s>
Implementation	O
of	O
this	O
rule	O
is	O
a	O
complex	O
problem	O
and	O
construction	O
of	O
these	O
histograms	B-Algorithm
is	O
also	O
a	O
complex	O
process	O
.	O
</s>
<s>
A	O
v-optimal	O
histogram	B-Algorithm
is	O
based	O
on	O
the	O
concept	O
of	O
minimizing	O
a	O
quantity	O
which	O
is	O
called	O
the	O
weighted	O
variance	O
in	O
this	O
context	O
.	O
</s>
<s>
where	O
the	O
histogram	B-Algorithm
consists	O
of	O
J	O
bins	O
or	O
buckets	O
,	O
nj	O
is	O
the	O
number	O
of	O
items	O
contained	O
in	O
the	O
jth	O
bin	O
and	O
where	O
Vj	O
is	O
the	O
variance	O
between	O
the	O
values	O
associated	O
with	O
the	O
items	O
in	O
the	O
jth	O
bin	O
.	O
</s>
<s>
The	O
following	O
example	O
will	O
construct	O
a	O
V-optimal	O
histogram	B-Algorithm
having	O
a	O
Sort	O
Value	O
of	O
Value	O
,	O
a	O
Source	O
Value	O
of	O
Frequency	O
,	O
and	O
a	O
Partition	O
Class	O
of	O
Serial	O
.	O
</s>
<s>
In	O
practice	O
,	O
almost	O
all	O
histograms	B-Algorithm
used	O
in	O
research	O
or	O
commercial	O
products	O
are	O
of	O
the	O
Serial	O
class	O
,	O
meaning	O
that	O
sequential	O
sort	O
values	O
are	O
placed	O
in	O
either	O
the	O
same	O
bucket	O
,	O
or	O
sequential	O
buckets	O
.	O
</s>
<s>
Our	O
V-optimal	O
histogram	B-Algorithm
will	O
have	O
two	O
buckets	O
.	O
</s>
<s>
The	O
first	O
choice	O
is	O
better	O
,	O
so	O
the	O
histogram	B-Algorithm
that	O
would	O
wind	O
up	O
being	O
stored	O
is	O
:	O
</s>
<s>
V-optimal	B-Application
histograms	I-Application
do	O
a	O
better	O
job	O
of	O
estimating	O
the	O
bucket	O
contents	O
.	O
</s>
<s>
A	O
histogram	B-Algorithm
is	O
an	O
estimation	O
of	O
the	O
base	O
data	O
,	O
and	O
any	O
histogram	B-Algorithm
will	O
have	O
errors	O
.	O
</s>
<s>
The	O
partition	O
rule	O
used	O
in	O
VOptimal	B-Application
histograms	I-Application
attempts	O
to	O
have	O
the	O
smallest	O
variance	O
possible	O
among	O
the	O
buckets	O
,	O
which	O
provides	O
for	O
a	O
smaller	O
error	O
.	O
</s>
<s>
Research	O
done	O
by	O
Poosala	O
and	O
Ioannidis	O
has	O
demonstrated	O
that	O
the	O
most	O
accurate	O
estimation	O
of	O
data	O
is	O
done	O
with	O
a	O
VOptimal	O
histogram	B-Algorithm
using	O
value	O
as	O
a	O
sort	O
parameter	O
and	O
frequency	O
as	O
a	O
source	O
parameter	O
.	O
</s>
<s>
While	O
the	O
V-optimal	O
histogram	B-Algorithm
is	O
more	O
accurate	O
,	O
it	O
does	O
have	O
drawbacks	O
.	O
</s>
<s>
Any	O
changes	O
to	O
the	O
source	O
parameter	O
could	O
potentially	O
result	O
in	O
having	O
to	O
re-build	O
the	O
histogram	B-Algorithm
entirely	O
,	O
rather	O
than	O
updating	O
the	O
existing	O
histogram	B-Algorithm
.	O
</s>
<s>
An	O
equi-width	O
histogram	B-Algorithm
does	O
not	O
have	O
this	O
problem	O
.	O
</s>
<s>
Equi-depth	O
histograms	B-Algorithm
will	O
experience	O
this	O
issue	O
to	O
some	O
degree	O
,	O
but	O
because	O
the	O
equi-depth	O
construction	O
is	O
simpler	O
,	O
there	O
is	O
a	O
lower	O
cost	O
to	O
maintain	O
it	O
.	O
</s>
<s>
The	O
difficulty	O
in	O
updating	O
VOptimal	B-Application
histograms	I-Application
is	O
an	O
outgrowth	O
of	O
the	O
difficulty	O
involved	O
in	O
constructing	O
these	O
histograms	B-Algorithm
.	O
</s>
<s>
Computing	O
the	O
V-optimal	O
histogram	B-Algorithm
is	O
computationally	O
expensive	O
to	O
compute	O
compared	O
to	O
other	O
types	O
of	O
histograms	B-Algorithm
.	O
</s>
<s>
However	O
,	O
as	O
the	O
range	O
of	O
values	O
gets	O
larger	O
and	O
the	O
number	O
of	O
buckets	O
gets	O
larger	O
,	O
the	O
set	O
of	O
possible	O
histograms	B-Algorithm
grows	O
exponentially	O
and	O
it	O
becomes	O
a	O
dauntingly	O
complex	O
problem	O
to	O
find	O
the	O
set	O
of	O
boundaries	O
that	O
provide	O
the	O
absolute	O
minimum	O
variance	O
using	O
the	O
naïve	O
approach	O
.	O
</s>
<s>
Using	O
dynamic	B-Algorithm
programming	I-Algorithm
,	O
it	O
is	O
possible	O
to	O
compute	O
the	O
V-optimal	O
histogram	B-Algorithm
in	O
where	O
N	O
is	O
the	O
number	O
of	O
data	O
points	O
and	O
B	O
is	O
the	O
number	O
buckets	O
.	O
</s>
<s>
Since	O
finding	O
the	O
optimal	O
histogram	B-Algorithm
is	O
quadratic	O
,	O
it	O
is	O
common	O
to	O
instead	O
approximate	O
the	O
V-optimal	O
histogram	B-Algorithm
.	O
</s>
<s>
These	O
algorithms	O
are	O
put	O
forth	O
in	O
"	O
Randomized	O
Algorithms	O
...	O
"	O
(	O
cited	O
below	O
)	O
as	O
a	O
method	O
to	O
optimize	O
queries	B-Language
,	O
but	O
the	O
general	O
idea	O
may	O
be	O
applied	O
to	O
construction	O
of	O
V-optimal	B-Application
Histograms	I-Application
.	O
</s>
<s>
Applied	O
to	O
the	O
construction	O
of	O
V-optimal	B-Application
histograms	I-Application
,	O
the	O
initial	O
random	O
state	O
would	O
be	O
a	O
set	O
of	O
values	O
representing	O
the	O
bucket	O
boundary	O
placements	O
.	O
</s>
<s>
The	O
idea	O
behind	O
V-optimal	B-Application
histograms	I-Application
is	O
to	O
minimize	O
the	O
variance	O
inside	O
each	O
bucket	O
.	O
</s>
<s>
This	O
is	O
the	O
idea	O
behind	O
"	O
End-Biased	O
"	O
V-optimal	B-Application
Histograms	I-Application
.	O
</s>
<s>
Such	O
a	O
histogram	B-Algorithm
can	O
be	O
constructed	O
by	O
using	O
a	O
Sort	O
Value	O
of	O
Frequency	O
and	O
a	O
Source	O
Value	O
of	O
Frequency	O
.	O
</s>
<s>
These	O
histograms	B-Algorithm
have	O
been	O
shown	O
to	O
be	O
less	O
accurate	O
,	O
due	O
to	O
the	O
additional	O
layer	O
of	O
estimation	O
required	O
.	O
</s>
