Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Performance > Re: Understandi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 8 Topic 4036 of 4352
Post > Topic >>

Re: Understanding histograms

by tgl@[EMAIL PROTECTED] (Tom Lane) Apr 30, 2008 at 01:19 AM

Len Shapiro <len@[EMAIL PROTECTED]
> writes:
> 1. Why does Postgres come up with a negative n_distinct?

It's a fractional representation.  Per the docs:

> stadistinct	float4	 	The number of distinct nonnull data values in the
column. A value greater than zero is the actual number of distinct values.
A value less than zero is the negative of a fraction of the number of rows
in the table (for example, a column in which values appear about twice on
the average could be represented by stadistinct = -0.5). A zero value
means the number of distinct values is unknown

> The "rows=2" estimate makes sense when const = 1 or 5, but it makes no
> sense to me for other values of const not in the MVC list.
> For example, if I run the query
> EXPLAIN SELECT * from sailors where rank = -1000;
> Postgres still gives an estimate of "row=2".

I'm not sure what estimate you'd expect instead?  The code has a built in
assumption that no value not present in the MCV list can be more
frequent than the last member of the MCV list, so it's definitely not
gonna guess *more* than 2.

			regards, tom lane

-- 
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
 




 8 Posts in Topic:
Understanding histograms
len@[EMAIL PROTECTED] (L  2008-04-29 21:56:32 
Re: Understanding histograms
tgl@[EMAIL PROTECTED] (T  2008-04-30 01:19:51 
Re: Understanding histograms
lenshap@[EMAIL PROTECTED]  2008-04-29 23:32:18 
Re: Understanding histograms
tgl@[EMAIL PROTECTED] (T  2008-04-30 10:43:11 
Re: Understanding histograms
pgsql@[EMAIL PROTECTED]   2008-04-30 15:47:02 
Re: Understanding histograms
tgl@[EMAIL PROTECTED] (T  2008-04-30 19:17:44 
Re: Understanding histograms
stark@[EMAIL PROTECTED]   2008-04-30 20:53:44 
Re: Understanding histograms
tgl@[EMAIL PROTECTED] (T  2008-05-01 00:41:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Oct 12 14:22:04 CDT 2008.