From: | Tadipathri Raghu <traghu(dot)dba(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Why index occupy less amount of space than the table with same structure. |
Date: | 2010-03-28 08:05:48 |
Message-ID: | 645d9d71003280105j14630cddqd86ca5af8c5fe800@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi All,
Here is small testing done by my end and am curious to know the reason.
Please find the example given below:-
postgres=# create table size_test(id int);
CREATE TABLE
postgres=# insert into size_test VALUES (generate_series(1,1000000));
INSERT 0 1000000
postgres=# select pg_size_pretty(pg_relation_size('size_test'));
pg_size_pretty
----------------
31 MB
(1 row)
postgres=# create index isize_test on size_test(id);
CREATE INDEX
postgres=# select pg_size_pretty(pg_relation_size('isize_test'));
pg_size_pretty
----------------
17 MB
(1 row)
postgres=# select pg_size_pretty(pg_total_relation_size('size_test'));
pg_size_pretty
----------------
48 MB
(1 row)
I like to know here is, I have created a table with one column and the index
is on one column only, so why is the space occupied differently, almost all
half of the space of the table and why not full. Could please you explain on
this. And what exactly the postgres architecture treat on Index table and
Ordinary table.
Thanks all in Advance
Regards
Raghavendra
From | Date | Subject | |
---|---|---|---|
Next Message | dipti shah | 2010-03-28 09:53:48 | Designing Postgres Security Model |
Previous Message | Tadipathri Raghu | 2010-03-28 07:14:41 | Re: How many Mandatory Process are there in Postgres |