Hi Tom,
Thanks, I have one query please refer below scenario.
1. Create table.
2. Insert 100 rows.
3. Delete 2 rows.
4. Truncate table.
5. Do vacuum
6. Insert 20 rows again. (Table count is 20 now)
Now n_tup_del = 2, n_tup_ins=120, n_live_tup=20 in pg_stat_user_tables, but
how can I figure out what has happened to 98 rows?
Regards,
Anit Chakkarwar
On Fri, Dec 13, 2013 at 11:14 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> anitchakkarwar@gmail.com writes:
> > If I do truncate then n_tup_del value is 0 but all the rows are deleted
> from
> > table.
> > Is this something expected behaviour ?
>
> Yes. We're certainly not going to make TRUNCATE update that count, since
> that would require making a pass over the table to count the to-be-deleted
> tuples, and the whole point of TRUNCATE is to not make a pass over the
> table.
>
> regards, tom lane
>