Re: [PERFORM] BUG #4919: CREATE USER command slows down system performance

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, toruvinn <toruvinn(at)lain(dot)pl>, pgsql-bugs(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] BUG #4919: CREATE USER command slows down system performance
Date: 2009-08-08 18:59:29
Message-ID: 20090808185929.GA9155@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-performance

Tom Lane wrote:

> Actually, I had forgotten that we were using the pg_database flatfile
> for purposes other than authentication checks. In particular, we need
> it during backend startup to map from database name to database OID,
> without which it's impossible to locate the system catalogs for the
> target database. It's pretty hard to see a way around that one.
> We could grovel through pg_database itself, as indeed is done to rebuild
> the flatfile during system start. But that's certainly not going to be
> fast in cases where there are enough DBs to make the flatfile slow.

Also, IIRC flatfiles were introduced precisely to avoid having to read
the catalogs manually.

> So on third thought, Alvaro's right: the only real solution here is to
> adopt a more efficient representation of the flat files. Maybe some
> sort of simple hashtable arrangement would work. (Rendering them not so
> flat anymore...)

As long as there's a simple API, there should be no problem.

(Except that it would be nice to be able to build the file incrementally
... If we have to write out a million lines each time a millionth user
is created, there will still be a bottleneck at CREATE USER time.)

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2009-08-08 19:15:39 Re: [PERFORM] BUG #4919: CREATE USER command slows down system performance
Previous Message Tom Lane 2009-08-08 18:49:01 Re: [PERFORM] BUG #4919: CREATE USER command slows down system performance

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2009-08-08 19:15:39 Re: [PERFORM] BUG #4919: CREATE USER command slows down system performance
Previous Message Tom Lane 2009-08-08 18:49:01 Re: [PERFORM] BUG #4919: CREATE USER command slows down system performance