From: Josh Berkus <josh@agliodbs.com>
To: Marko Ristola <marko.ristola@kolumbus.fi>
Cc: pgsql-perform <pgsql-performance@postgresql.org>
Subject: Re: Bad n_distinct estimation; hacks suggested?
Date: Fri, 22 Apr 2005 13:36:08 -0700
Message-ID: <200504221336.08325.josh@agliodbs.com> (raw)
In-Reply-To: <200504221152.51736.josh@agliodbs.com>
References: <200504191209.05181.josh@agliodbs.com>
<426944D0.6040706@kolumbus.fi>
<200504221152.51736.josh@agliodbs.com>
> > Solaris is unknown to me. Maybe the used random number generator there
> > isn't good enough?
>
> Hmmm. Good point. Will have to test on Linux.
Nope:
Linux 2.4.20:
test=# select tablename, attname, n_distinct from pg_stats where tablename =
'web_site_activity_fa';
tablename | attname | n_distinct
----------------------+---------------------+------------
web_site_activity_fa | session_id | 626127
test=# select count(distinct session_id) from web_site_activity_fa;
count
---------
3174813
(1 row)
... I think the problem is in our heuristic sampling code. I'm not the first
person to have this kind of a problem. Will be following up with tests ...
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: josh@agliodbs.com, marko.ristola@kolumbus.fi
Subject: Re: Bad n_distinct estimation; hacks suggested?
In-Reply-To: <200504221336.08325.josh@agliodbs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox