From 4af3421161ce7847a019ec0799c898586574801f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 8 May 2004 19:09:25 +0000 Subject: Get rid of rd_nblocks field in relcache entries. Turns out this was costing us lots more to maintain than it was worth. On shared tables it was of exactly zero benefit because we couldn't trust it to be up to date. On temp tables it sometimes saved an lseek, but not often enough to be worth getting excited about. And the real problem was that we forced an lseek on every relcache flush in order to update the field. So all in all it seems best to lose the complexity. --- contrib/pgstattuple/pgstattuple.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'contrib/pgstattuple/pgstattuple.c') diff --git a/contrib/pgstattuple/pgstattuple.c b/contrib/pgstattuple/pgstattuple.c index ca082618568..98b4cc3d519 100644 --- a/contrib/pgstattuple/pgstattuple.c +++ b/contrib/pgstattuple/pgstattuple.c @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.14 2004/04/01 21:28:43 tgl Exp $ + * $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.15 2004/05/08 19:09:24 tgl Exp $ * * Copyright (c) 2001,2002 Tatsuo Ishii * @@ -127,9 +127,10 @@ pgstattuple_real(Relation rel) */ attinmeta = TupleDescGetAttInMetadata(tupdesc); - nblocks = RelationGetNumberOfBlocks(rel); scan = heap_beginscan(rel, SnapshotAny, 0, NULL); + nblocks = scan->rs_nblocks; /* # blocks to be scanned */ + /* scan the relation */ while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { -- cgit v1.2.3