Re: PostgreSQL Process memory architecture

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: "Ben Zeev, Lior" <lior(dot)ben-zeev(at)hp(dot)com>
Cc: Atri Sharma <atri(dot)jiit(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PostgreSQL Process memory architecture
Date: 2013-05-27 12:42:54
Message-ID: 20130527124254.GN8597@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Lior,

* Ben Zeev, Lior (lior(dot)ben-zeev(at)hp(dot)com) wrote:
> The case which I'm seeing is that I have an empty table without any rows,
> Create table test (
> Num Integer,
> C1 character varying(512),
> C2 character varying(512),
> C3 character varying(512));
>
> I create several partial indexes on this table:
>
> Create index(index_1_c1) on test(c1) where Num=1;
> Create index(index_2_c1) on test(c1) where Num=2;
> Create index(index_1_c2) on test(c1) where Num=1;
> Create index(index_2_c2) on test(c1) where Num=2;
> ...
>
> This doesn't consume much memory on the PostgreSQL backend process,
> But if I create 500 indexes It consume several MB of memory.

When are you seeing this memory utilization..? When running a query
against that table? At backend start?

> If I have 10 tables with 500 indexes each PostgreSql backend process consume 20MB,
> If I have 100 tables with 500 indexes each PostgreSQL backend process consume 200MB
>
> All tables are empty without data.

Are you accessing all of those tables inside of one query? Or one
transaction, or..?

> What is the reason to consume so much memory for empty indexes?

I'm curious what you would expect to be happening here. We need to pull
in information about the index in order to consider it during planning.
Special-caseing empty indexes might be possible, but what's the point of
having hundreds of empty indexes against a table in the first place?

Thanks,

Stephen

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2013-05-27 12:45:00 Re: PostgreSQL Process memory architecture
Previous Message Ben Zeev, Lior 2013-05-27 12:41:17 Re: PostgreSQL Process memory architecture