pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Litao Wu <litaowu@yahoo.com>
To: josh@agliodbs.com
To: pgsql-performance@postgresql.org
Subject: Re: index's relpages after table analyzed
Date: Mon, 24 May 2004 12:48:03 -0700 (PDT)
Message-ID: <20040524194803.8970.qmail@web13125.mail.yahoo.com> (raw)
In-Reply-To: <200405241205.26170.josh@agliodbs.com>

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/ 



view thread (5+ messages)  latest in thread

Message-ID: <20040524194803.8970.qmail@web13125.mail.yahoo.com>
Permalink:  ../20040524194803.8970.qmail@web13125.mail.yahoo.com/
Also on:    postgresql.org/message-id/20040524194803.8970.qmail@web13125.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: litaowu@yahoo.com, josh@agliodbs.com
  Subject: Re: index's relpages after table analyzed
  In-Reply-To: <20040524194803.8970.qmail@web13125.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox