Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0) - Mailing list pgsql-general

From Bruce Momjian
Subject Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0)
Date
Msg-id 200002280910.EAA20835@candle.pha.pa.us
Whole thread Raw
In response to Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0)  (Serge Sozonoff <serge@globalbeach.com>)
Responses Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0)  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-general
> If I have 40 tables and each table is made up of 6-7 files including
> index's etc then that
> means that per process I could be opening up to 200-240 !!
>
> This means that with 64 db connections I could be hitting  12800-15360 open
> files
> on my system!!! What is the current Linux limit without kernel re-compile?
> What is the Linux
> limit with kernel re-compile?
>
> Why can't I just tell postgres to close thos files say 2 minutes after he
> is done with them
> and they have been idle?

Take a look at /pg/backend/storage/file/fd.c::pg_nofile().  If you
change the line:

    return no_files;

to

   return 32;

PostgreSQL will never use more than 32 files open at the same time.
Setting this too low will cause the system not to start.  The default is
to allow opening of the maximum number of open files for a process.
There is no "close after X minutes of inactivity", though file
descriptors are closed as they reach the pg_nofile limit.

Give it a try and let us know how you like it.  Maybe we can add a
configuration option for this.


--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-general by date:

Previous
From: Serge Sozonoff
Date:
Subject: Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0)
Next
From: Bruce Momjian
Date:
Subject: Re: open pgsql files (was Re: [GENERAL] Mime-Version: 1.0)