calculating table and index size

From: Günce Kaya <guncekaya14(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: calculating table and index size
Date: 2017-04-05 07:44:37
Message-ID: CAAV2-mW_vtzDqqWbhQWZDJ+RAkzyN+wscNBOZ5t2Jqw5KCwxKA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

Hi all,

I have some questions about calculating table and index size.

I have a dummy table which has an integer column and its index. The table
has 1400000 rows and all of rows are same thats value is 20000000. Table
size is 50MB and index size is 31MB. Why there is too much size difference
between table and its index? what happen on data files when we add index?

Second question is that after created table, table size was 0 byte. I
inserted a row as 120 then table size was 8192 byte. I inserted five times
same value to the table and table size is still 8192 bytes. Table size
changed after inserted lots of rows. Table size was stabile till first few
hundred rows. why table size didn't change when I inserted lots of rows?

Is there anyone can explain two questions?

Best regards
--
Gunce Kaya

Linkedin <https://tr.linkedin.com/in/guncekaya> - Twitter
<https://twitter.com/gguncesi> - Blog
<http://www.guncekaya.blogspot.com.tr/>

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Guillaume Lelarge 2017-04-05 08:56:49 Re: calculating table and index size
Previous Message Joshua D. Drake 2017-04-04 23:11:29 Re: pgsql and lxc containers input

Browse pgsql-general by date

  From Date Subject
Next Message Chris Mair 2017-04-05 08:01:52 expensive function in select list vs limit clause
Previous Message Daniel Westermann 2017-04-05 07:28:03 Re: Query never completes with low work_mem (at least not within one hour)