Re: [BUGS] BUG #4919: CREATE USER command slows down system performance - Mailing list pgsql-performance

From Alvaro Herrera
Subject Re: [BUGS] BUG #4919: CREATE USER command slows down system performance
Date
Msg-id 20090808185929.GA9155@alvh.no-ip.org
Whole thread Raw
In response to Re: [BUGS] BUG #4919: CREATE USER command slows down system performance  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUGS] BUG #4919: CREATE USER command slows down system performance
List 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.

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #4919: CREATE USER command slows down system performance
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #4919: CREATE USER command slows down system performance