Bug? relpages, reltuples resets to zero

Поиск
Список
Период
Сортировка
От jwieck@debis.com (Jan Wieck)
Тема Bug? relpages, reltuples resets to zero
Дата
Msg-id m0zWQUJ-000EBPC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответы Re: [HACKERS] Bug? relpages, reltuples resets to zero
Re: [HACKERS] Bug? relpages, reltuples resets to zero
pg_indexes
Список 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@debis.com (Jan Wieck) #

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: y2k
Следующее
От: darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Сообщение: Re: [HACKERS] Re: y2k