I do not know whether this what you are looking for:
select * from pg_stats where tablename = 't_refs';
schemaname | tablename | attname | null_frac | avg_width |
n_distinct | most_common_vals | most_common_freqs |
histogram_bounds
| correlation
------------+-------------+----------+-----------+-----------+----------
--+--------------------+-------------------+----------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------+-------------
prod | t_refs | refid | 0 | 4 | -0.103007 |
{3015397} | {0.000666667} |
{653,2471487,2979200,3413832,5264245,6331043,6937529,7784921,8629416,189
45386,22438228}
| 0.999997
prod | t_refs | docid | 0 | 20 | -0.103007 |
{UU000005835738A_} | {0.000666667} |
{DD000002138111A1,PP000000392895A2,JJ001996061410A_,UU000002979269A_,UU0
00003695300A_,UU000004114255A_,UU000004488542A_,UU000004843496A_,UU00000
5258342A_,UU000005754178A_,WW002001026472A1} | -0.226872
select * from pg_stats where tablename = 't_documents';
bib=# select * from pg_stats where tablename = 't_documents';
schemaname | tablename | attname | null_frac | avg_width |
n_distinct |
most_common_vals |
most_common_freqs |
histogram_bounds
| correlation
------------+-----------+----------------------+-----------+-----------+
------------+-----------------------------------------------------------
------------------------------------------------------+-----------------
------------------------------------------------------------------------
------------------------+-----------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
-----------------------------+--------------
prod | t_documents | documentid | 0 | 4
| -1 |
|
|
{4412,2108436,4019706,6197781,8156754,9979302,14177441,16191587,18253432
,20472500,22408280}
| 0.444682
prod | t_documents | docid | 0 | 20
| -1 |
|
|
{DD000000336233T1,PP000000284550A1,GB000000613469A_,JJ001984091431A_,JJ0
01992265537A_,JJ001998164783A_,UU000000488247A_,UU000002597243A_,UU00000
4506762A_,UU000006365747B1,WW002003043835A1}
| 0.168566
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Monday, July 07, 2003 10:14 PM
To: Maksim Likharev
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] PG crash on simple query, story continues
"Maksim Likharev" <mlikharev@aurigin.com> writes:
> SELECT p.docid FROM prod.t_documents AS p
> INNER JOIN t_tempdocs AS t
> ON p.docid = t.docid
> LEFT OUTER JOIN prod.t_refs AS ct
> ON ct.docid = p.docid;
> here is a stack trace:
> 00252174 AllocSetAlloc (3813b0, 15, 251fe0, 20, 0, ffbee2f8) + 194
> 002532e4 MemoryContextAlloc (3813b0, 15, 11, 7efefeff, 81010100,
ff00)
> + 68
> 0020dc0c varcharin (ffbee378, ffbee378, 20dae4, 0, 0, ffbee3f0) + 128
> 00243570 FunctionCall3 (ffbee4a8, 3c1ce8, 0, 324, 0, ffbee5c4) + 11c
> 0023e6c4 get_attstatsslot (3d6410, 413, 324, 2, 0, ffbee5c4) + 2b0
> 001f8cb4 scalarineqsel (3bb978, 42a, 0, 3bffa8, 40f0e8, 413) + 288
> 001fb824 mergejoinscansel (3bb978, 3c0080, 3c0968, 3c0970, 0, 1) +
23c
Hmm, it would seem there's something flaky about your pg_statistic
entries. Could we see the pg_stats rows for the columns mentioned
in this query?
regards, tom lane