Re: An Analyze question - Mailing list pgsql-admin

From Tom Lane
Subject Re: An Analyze question
Date
Msg-id 17407.1019497221@sss.pgh.pa.us
Whole thread Raw
In response to Re: An Analyze question  ("Nick Fankhauser" <nickf@ontko.com>)
Responses Re: An Analyze question
List pgsql-admin
"Nick Fankhauser" <nickf@ontko.com> writes:
> The "Before" database:

>          attname          | attdispersion | starelid | staattnum | staop |
> stanullfrac | stacommonfrac | stacommonval  |          staloval           |
> stahival
> --------------------------+---------------+----------+-----------+-------+--
> -----------+---------------+---------------+-----------------------------+--
> ---------------------
>  actor_id                 |    0.00761992 |  2591915 |         1 |  1066 |
> 0 |     0.0335872 | JTW           | 18105A08315 49              | XS

> The "After" database:

>          attname          | attdispersion | starelid | staattnum | staop |
> stanullfrac | stacommonfrac |    stacommonval    |          staloval
> |       stahival
> --------------------------+---------------+----------+-----------+-------+--
> -----------+---------------+--------------------+---------------------------
> -+-----------------------
>  actor_id                 |       0.03247 | 33979335 |         1 |  1066 |
> 0 |      0.112092 | 18105XS            | 18105A                     |
> 18105XS

Hm.  In the "before" case you are showing JTW as the most common
actor_id, with a frequency of 3.36% of the entries (busy judge,
I suppose).

In the "after" case you are showing "18105XS" as the most common
actor_id, with a frequency of 11.2% of the entries.  Where'd that
come from?  Is it correct?

The change in plans occurs because of the increase in stacommonfrac.
7.1 basically uses stacommonfrac as the selectivity estimate if the
constant is the stacommonval, otherwise stacommonfrac/10.  So if
stacommonfrac goes up, so does the estimated number of rows retrieved,
and that's what's changing your plan.

            regards, tom lane

pgsql-admin by date:

Previous
From: Denny-Schierz
Date:
Subject: Linux user www-data has no access to amphora2 DB
Next
From: Denny-Schierz
Date:
Subject: Linux user www-data has no access to amphora2 DB_New