pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
index's relpages after table analyzed
5+ messages / 3 participants
[nested] [flat]

* index's relpages after table analyzed
@ 2004-05-24 16:51  Litao Wu <litaowu@yahoo.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Litao Wu @ 2004-05-24 16:51 UTC (permalink / raw)
  To: pgsql-performance

Hi, 

After a table analyzed a table, the table's relpages 
of pg_class gets updated, but not those of associated 
indexes, which can be updated by "vacuum analyze".

Is this a feature or a bug?

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. 

Does the above "future/bug" affect the performance?

My PG version is 7.3.2.

Thanks,




	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: index's relpages after table analyzed
@ 2004-05-24 17:20  Litao Wu <litaowu@yahoo.com>
  parent: Litao Wu <litaowu@yahoo.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Litao Wu @ 2004-05-24 17:20 UTC (permalink / raw)
  To: Litao Wu <litaowu@yahoo.com>; pgsql-performance

From PG
http://developer.postgresql.org/docs/postgres/diskusage.html:

"(Remember, relpages is only updated by VACUUM and
ANALYZE.)"


--- Litao Wu <litaowu@yahoo.com> wrote:
> Hi, 
> 
> After a table analyzed a table, the table's relpages
> 
> of pg_class gets updated, but not those of
> associated 
> indexes, which can be updated by "vacuum analyze".
> 
> Is this a feature or a bug?
> 
> 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. 
> 
> Does the above "future/bug" affect the performance?
> 
> My PG version is 7.3.2.
> 
> Thanks,
> 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Domains ?Claim yours for only $14.70/year
> http://smallbusiness.promotions.yahoo.com/offer 
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 8: explain analyze is your friend



	
		
__________________________________
Do you Yahoo!?
Yahoo! Domains – Claim yours for only $14.70/year
http://smallbusiness.promotions.yahoo.com/offer 



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: index's relpages after table analyzed
@ 2004-05-24 19:05  Josh Berkus <josh@agliodbs.com>
  parent: Litao Wu <litaowu@yahoo.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Josh Berkus @ 2004-05-24 19:05 UTC (permalink / raw)
  To: Litao Wu <litaowu@yahoo.com>; pgsql-performance

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




^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: index's relpages after table analyzed
@ 2004-05-24 19:48  Litao Wu <litaowu@yahoo.com>
  parent: Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Litao Wu @ 2004-05-24 19:48 UTC (permalink / raw)
  To: josh@agliodbs.com; 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@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/ 



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: index's relpages after table analyzed
@ 2004-05-25 01:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Litao Wu <litaowu@yahoo.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2004-05-25 01:22 UTC (permalink / raw)
  To: Litao Wu <litaowu@yahoo.com>; +Cc: josh@agliodbs.com; pgsql-performance

Litao Wu <litaowu@yahoo.com> writes:
> My question is why relpages of indexes
> do not get updated after "analyze".

It's an oversight, which just got fixed in CVS tip a few weeks ago.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2004-05-25 01:22 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-24 16:51 index's relpages after table analyzed Litao Wu <litaowu@yahoo.com>
2004-05-24 17:20 ` Litao Wu <litaowu@yahoo.com>
2004-05-24 19:05 ` Josh Berkus <josh@agliodbs.com>
2004-05-24 19:48   ` Litao Wu <litaowu@yahoo.com>
2004-05-25 01:22     ` Tom Lane <tgl@sss.pgh.pa.us>

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