Bug? relpages, reltuples resets to zero

From: jwieck(at)debis(dot)com (Jan Wieck)
To: pgsql-hackers(at)postgreSQL(dot)org (PostgreSQL HACKERS)
Subject: Bug? relpages, reltuples resets to zero
Date: 1998-10-22 19:33:34
Message-ID: m0zWQUJ-000EBPC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

there seems to be a problem with the relation statistics in
pg_class. Could someone explain why this happens?

doc=> vacuum;
VACUUM
doc=> select relname, relpages, reltuples from pg_class
doc-> where relname = 'doc_wordref';
relname |relpages|reltuples
-----------+--------+---------
doc_wordref| 1099| 136027
(1 row)

-- ******** That's right

doc=> explain select distinct refpage from doc_wordref
doc-> where refword ~ '^a';
NOTICE: QUERY PLAN:

Unique
-> Sort
-> Index Scan using doc_wordref_word_idx on doc_wordref

EXPLAIN

-- ******** As expected

doc=> select distinct refpage from doc_wordref
doc-> where refword ~ '^a';
refpage
-------
2
3
...
(164 rows)

doc=> select relname, relpages, reltuples from pg_class
doc-> where relname = 'doc_wordref';
relname |relpages|reltuples
-----------+--------+---------
doc_wordref| 0| 0
(1 row)

-- ******** Ooops - where are they gone?

doc=> explain select distinct refpage from doc_wordref
dos-> where refword ~ '^a';
NOTICE: QUERY PLAN:

Unique
-> Sort
-> Index Scan using doc_wordref_word_idx on doc_wordref

-- ******** Doesn't matter in the same connection, so reconnect

EXPLAIN
doc=> \c -
connecting to new database: doc
doc=> explain select distinct refpage from doc_wordref
dos-> where refword ~ '^a';
NOTICE: QUERY PLAN:

Unique
-> Sort
-> Seq Scan on doc_wordref

-- ******** Boom

EXPLAIN
doc=>

Why does the SELECT throw away the information about the
number of pages and tuples from pg_class? Is this a bug or a
feature? If it's a feature, how can I disable it? It is
reproduceable.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck(at)debis(dot)com (Jan Wieck) #

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1998-10-22 20:10:06 Re: [HACKERS] Re: y2k
Previous Message Bruce Momjian 1998-10-22 17:58:58 Re: [HACKERS] Re: y2k