Thread: What are the advantages of not being able to access multiple databases with one connection?
What are the advantages of not being able to access multiple databases with one connection?
From
crocket
Date:
MySQL permits a connection to access multiple databases. But Postgresql restricts a connection to one database. I think postgresql database connection is somewhat limited. Is it an old and decrepit design? or does it deserve some appreciations?
Re: What are the advantages of not being able to access multiple databases with one connection?
From
Will Crawford
Date:
On 30 October 2012 12:37, crocket <crockabiscuit@gmail.com> wrote: > MySQL permits a connection to access multiple databases. > But Postgresql restricts a connection to one database. > I think postgresql database connection is somewhat limited. > > Is it an old and decrepit design? or does it deserve some appreciations? Actually, a "database" in postgresql supports multiple "schemas", and the "databases" in mysql are more or less congruent to those. To put it another way, pg has a three-level namespace which can be accessed through the same host and port combination; mysql only has two levels. Is that better?
Re: What are the advantages of not being able to access multiple databases with one connection?
From
Hannu Krosing
Date:
On 10/30/2012 01:37 PM, crocket wrote: > MySQL permits a connection to access multiple databases. > But Postgresql restricts a connection to one database. > I think postgresql database connection is somewhat limited. > > Is it an old and decrepit design? or does it deserve some appreciations? It's an old and decrepit design ;) But nobody has found the ability to use many databases from the same connection valuable enough to do the rewrite needed. If you have ideas on how to enable access to multiple databases from the same connection - both at technical and logical level (i.e. what it would _mean_ and how it would be expressed in SQL) then sure people would be ready to gear you out. It would be valuable at least for some tools doing monitoring and maintenance even in case SQL access to multiple databases simultaneously would not be available. For example it would be nice to get pg_stat_user_tables() info for all databases in a single query or at least to switch databases (say using SET DATABASE <dbname>) without reconnecting. Hannu
Re: What are the advantages of not being able to access multiple databases with one connection?
From
Robert Haas
Date:
On Tue, Oct 30, 2012 at 8:37 AM, crocket <crockabiscuit@gmail.com> wrote: > MySQL permits a connection to access multiple databases. > But Postgresql restricts a connection to one database. > I think postgresql database connection is somewhat limited. > > Is it an old and decrepit design? or does it deserve some appreciations? I think it deserves some appreciation. Each database is completely isolated in terms of privileges, which is sometimes useful. Also, if you somehow manage to fry the system catalogs in one database, the other ones can still survive. The role played by databases in MySQL is served by schemas in PostgreSQL, so I don't see that there is a functional gap here. I am not sure I'd bother implementing the multi-database concept today if we didn't have it already ... but it seems kind of pointless to rip it out given that it's already there. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Re: What are the advantages of not being able to access multiple databases with one connection?
From
Josh Berkus
Date:
> functional gap here. I am not sure I'd bother implementing the > multi-database concept today if we didn't have it already ... but it > seems kind of pointless to rip it out given that it's already there. It's very useful for webhosts. You can give each user their own private database and not worry about them hacking into other peoples'. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com
Re: What are the advantages of not being able to access multiple databases with one connection?
From
Merlin Moncure
Date:
On Mon, Nov 5, 2012 at 11:33 AM, Robert Haas <robertmhaas@gmail.com> wrote: > On Tue, Oct 30, 2012 at 8:37 AM, crocket <crockabiscuit@gmail.com> wrote: >> MySQL permits a connection to access multiple databases. >> But Postgresql restricts a connection to one database. >> I think postgresql database connection is somewhat limited. >> >> Is it an old and decrepit design? or does it deserve some appreciations? > > I think it deserves some appreciation. Each database is completely > isolated in terms of privileges, which is sometimes useful. Also, if > you somehow manage to fry the system catalogs in one database, the > other ones can still survive. The role played by databases in MySQL > is served by schemas in PostgreSQL, so I don't see that there is a > functional gap here. I am not sure I'd bother implementing the > multi-database concept today if we didn't have it already ... but it > seems kind of pointless to rip it out given that it's already there. A little trivia: postgres supports full database qualified identifier names: postgres=# select postgres.public.foo.i from postgres.public.foo; Even though you can't specify any other database than the one you're in. merlin