Thread

  1. pg_class : reltuples

    Sandeep Joshi <sjoshi@zambeel.com> — 2000-11-22T20:05:16Z

    What does "reltuples" from pg_class represent?
    any comments
    Here is something that raised this question:
    
    ---------------------------------------
    testdb=# select count(*) from zuser3;
      count
    ---------
     1000000
    (1 row)
    
    testdb=#  select count(*) from zuser2;
     count
    --------
     100000
    (1 row)
    
    testdb=# select count(*) from zuser1;
     count
    -------
      1000select relname,relpages,reltuples from pg_class where relname like
    'zuse%';
     relname | relpages | reltuples
    ---------+----------+-----------
     zuser2  |       10 |      1000
     zuser1  |       10 |      1000
     zuser3  |       10 |      1000
    (3 rows)
    
    (1 row)
    
    
    
    
  2. Re: pg_class : reltuples

    Tom Lane <tgl@sss.pgh.pa.us> — 2000-11-22T20:20:20Z

    Sandeep Joshi <sjoshi@Zambeel.com> writes:
    > I had to run "vacuum" to get corect no.s.  Why is that? I thought
    > "pg_class" will be upto date.
    
    reltuples and relpages are just updated by vacuum (and maybe create
    index).  They're not intended to be accurate values, only approximate
    statistics.
    
    			regards, tom lane
    
    
  3. Re: pg_class : reltuples

    Sandeep Joshi <sjoshi@zambeel.com> — 2000-11-22T20:20:59Z

    I had to run "vacuum" to get corect no.s.  Why is that? I thought
    "pg_class" will be upto date.
    This makes me nervous.
    
    Sandeep
    
    
    
    > What does "reltuples" from pg_class represent?
    > any comments
    > Here is something that raised this question:
    >
    > ---------------------------------------
    > testdb=# select count(*) from zuser3;
    >   count
    > ---------
    >  1000000
    > (1 row)
    >
    > testdb=#  select count(*) from zuser2;
    >  count
    > --------
    >  100000
    > (1 row)
    >
    > testdb=# select count(*) from zuser1;
    >  count
    > -------
    >   1000
    
    > select relname,relpages,reltuples from pg_class where relname like
    > 'zuse%';
    >  relname | relpages | reltuples
    > ---------+----------+-----------
    >  zuser2  |       10 |      1000
    >  zuser1  |       10 |      1000
    >  zuser3  |       10 |      1000
    > (3 rows)
    >
    > (1 row)