Re: index's relpages after table analyzed

From: Litao Wu <litaowu(at)yahoo(dot)com>
To: josh(at)agliodbs(dot)com, pgsql-performance(at)postgresql(dot)org
Subject: Re: index's relpages after table analyzed
Date: 2004-05-24 19:48:03
Message-ID: 20040524194803.8970.qmail@web13125.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Josh,

I know that and that is what I am using now.
The problem is I also need to know
the relpages each indexe takes and "analyze"
seems not update relpages though vacuum and
vacuum analyze do.

According to PG doc:
"Remember, relpages is only updated by VACUUM and
ANALYZE"

My question is why relpages of indexes
do not get updated after "analyze".

Here is a quick test:
create table test as select * from pg_class where 1=2;
create index test_idx on test (relname);
insert into test select * from pg_class;
select relname, relpages from pg_class
where relname in ('test', 'test_idx');
relname | relpages
----------+----------
test | 10
test_idx | 1
(2 rows)

analyze test;
select relname, relpages from pg_class
where relname in ('test', 'test_idx');
relname | relpages
----------+----------
test | 27
test_idx | 1
(2 rows)
-- Analyze only updates table's relpage, not index's!

vacuum analyze test;
select relname, relpages from pg_class
where relname in ('test', 'test_idx');
relname | relpages
----------+----------
test | 27
test_idx | 22
(2 rows)
-- "acuum analzye" updates both
-- "vacuum" only also updates both

Thank you for your help!

--- Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> Litao,
>
> > I have some tables and there are almost only
> > inserts. So I do not care about the "dead tuples",
> > but do care about the statistics.
>
> Then just run ANALYZE on those tables, and not
> VACUUM.
> ANALYZE <table-name>;
>
> > My PG version is 7.3.2.
>
> I would suggest upgrading to 7.3.6; the version you
> are using has several
> known bugs.
>
> --
> -Josh Berkus
> Aglio Database Solutions
> San Francisco
>



__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Marty Scholes 2004-05-24 22:52:02 Re: PostgreSQL caching
Previous Message Josh Berkus 2004-05-24 19:08:50 Re: Avoiding vacuum full on an UPDATE-heavy table