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@agliodbs.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/