Unix Technical Forum

CREATE DATABASE fails when template1 being accessed ...

This is a discussion on CREATE DATABASE fails when template1 being accessed ... within the pgsql Hackers forums, part of the PostgreSQL category; --> ERROR: source database "template1" is being accessed by other users Why is this not allowed? Not that there is ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 05:08 AM
Marc G. Fournier
 
Posts: n/a
Default CREATE DATABASE fails when template1 being accessed ...



ERROR: source database "template1" is being accessed by other users

Why is this not allowed? Not that there is generally a reason to be in
template1, but am curious as to why it prevents a new DB from being
created if someone is connected to it ...

----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 05:08 AM
Tom Lane
 
Posts: n/a
Default Re: CREATE DATABASE fails when template1 being accessed ...

"Marc G. Fournier" <scrappy@postgresql.org> writes:
> ERROR: source database "template1" is being accessed by other users


> Why is this not allowed?


It's a rather lame attempt to ensure that you don't get a corrupt copy
due to the database changing while you copy it ... I'd like to find
a better way to do it ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 05:08 AM
Bruno Wolff III
 
Posts: n/a
Default Re: CREATE DATABASE fails when template1 being accessed ...

On Tue, May 31, 2005 at 14:53:41 -0300,
"Marc G. Fournier" <scrappy@postgresql.org> wrote:
>
>
> ERROR: source database "template1" is being accessed by other users
>
> Why is this not allowed? Not that there is generally a reason to be in
> template1, but am curious as to why it prevents a new DB from being
> created if someone is connected to it ...


Because if someone changes something in the database while it is being
copied, the newly created database will probably be messed up.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-11-2008, 05:08 AM
Alvaro Herrera
 
Posts: n/a
Default Re: CREATE DATABASE fails when template1 being accessed ...

On Tue, May 31, 2005 at 02:53:41PM -0300, Marc G. Fournier wrote:

> ERROR: source database "template1" is being accessed by other users
>
> Why is this not allowed? Not that there is generally a reason to be in
> template1, but am curious as to why it prevents a new DB from being
> created if someone is connected to it ...


Because we copy the files directly. So if someone modifies one file in
the middle of the copy, or, say, we copy one index and later the table
and someone inserts into a table in the middle, then the new database is
in an inconsistent state.

There has been talk about fixing this in the past, but conclusion seems
to be "too hard to fix for too little benefit."

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"No hay hombre que no aspire a la plenitud, es decir,
la suma de experiencias de que un hombre es capaz"

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 05:08 AM
Tom Lane
 
Posts: n/a
Default Re: CREATE DATABASE fails when template1 being accessed ...

Alvaro Herrera <alvherre@surnet.cl> writes:
> On Tue, May 31, 2005 at 02:49:09PM -0400, Tom Lane wrote:
>> It's a rather lame attempt to ensure that you don't get a corrupt copy
>> due to the database changing while you copy it ... I'd like to find
>> a better way to do it ...


> You sounded less enthusiastic about it on january:
> http://archives.postgresql.org/pgsql...1/msg00395.php


Well, I was expressing dissatisfaction with the obvious way of fixing
it. If we knew a low-overhead way to fix it I'd be much more
enthusiastic ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-11-2008, 05:08 AM
Alvaro Herrera
 
Posts: n/a
Default Re: CREATE DATABASE fails when template1 being accessed ...

On Tue, May 31, 2005 at 02:49:09PM -0400, Tom Lane wrote:
> "Marc G. Fournier" <scrappy@postgresql.org> writes:
> > ERROR: source database "template1" is being accessed by other users

>
> > Why is this not allowed?

>
> It's a rather lame attempt to ensure that you don't get a corrupt copy
> due to the database changing while you copy it ... I'd like to find
> a better way to do it ...


You sounded less enthusiastic about it on january:

http://archives.postgresql.org/pgsql...1/msg00395.php

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"Investigación es lo que hago cuando no sé lo que estoy haciendo"
(Wernher von Braun)

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-11-2008, 05:08 AM
Jonah H. Harris
 
Posts: n/a
Default Tablespace-level Block Size Definitions

Hey everyone,

I'm sure this has been thought of but was wondering whether anyone had
discussed the allowance of run-time block size specifications at the
tablespace level? I know that a change such as this would substantially
impact buffer operations, transactions, access methods, the storage
manager, and a lot of other stuff, however it would give an
administrator the ability to inhance performance for specific applications.

Arguably, one can set the block size at compile-time, but for a system
running multiple databases it *may* be a nice feature. Would it be used
a lot? Probably not. Would I use it? Certainly! Would some of my
clients use it? Yes.

Perhaps a TODO item for some advantageous company to fund?

-Jonah


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-11-2008, 05:08 AM
Tom Lane
 
Posts: n/a
Default Re: Tablespace-level Block Size Definitions

"Jonah H. Harris" <jharris@tvi.edu> writes:
> I'm sure this has been thought of but was wondering whether anyone had
> discussed the allowance of run-time block size specifications at the
> tablespace level?


Can you produce any evidence whatsoever that this could be worth the cost?
Aside from the nontrivial development effort needed, there would be
runtime inefficiencies created --- for instance, inefficient use of
buffer pool storage because it'd no longer be true that any buffer could
hold any block. Without some pretty compelling evidence, I wouldn't
even waste any time thinking about it ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-11-2008, 05:08 AM
Bricklen Anderson
 
Posts: n/a
Default Re: Tablespace-level Block Size Definitions

Jonah H. Harris wrote:
> Hey everyone,
>
> I'm sure this has been thought of but was wondering whether anyone had
> discussed the allowance of run-time block size specifications at the
> tablespace level? I know that a change such as this would substantially
> impact buffer operations, transactions, access methods, the storage
> manager, and a lot of other stuff, however it would give an
> administrator the ability to inhance performance for specific applications.
>
> Arguably, one can set the block size at compile-time, but for a system
> running multiple databases it *may* be a nice feature. Would it be used
> a lot? Probably not. Would I use it? Certainly! Would some of my
> clients use it? Yes.
>
> Perhaps a TODO item for some advantageous company to fund?
>
> -Jonah


Have you used Oracle's version as well?

--
_______________________________

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
_______________________________

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-11-2008, 05:08 AM
Alvaro Herrera
 
Posts: n/a
Default Re: Tablespace-level Block Size Definitions

On Tue, May 31, 2005 at 02:55:29PM -0600, Jonah H. Harris wrote:
> Hey everyone,
>
> I'm sure this has been thought of but was wondering whether anyone had
> discussed the allowance of run-time block size specifications at the
> tablespace level? I know that a change such as this would substantially
> impact buffer operations, transactions, access methods, the storage
> manager, and a lot of other stuff, however it would give an
> administrator the ability to inhance performance for specific applications.


The problem I see with this proposal is that the buffer manager knows
how to handle only a equally-sized pages. And the shared memory stuff
gets sized according to size * num_pages. So what happens if a certain
tablespace A with pagesize=X gets to have a lot of its pages cached,
evicting pages from tablespace B with pagesize=Y, where Y < X?

While I think it could be workable to make the buffer manager handle
variable-sized pages, it could prove difficult to handle the shared
memory. (We can't resize it while the server is running.)

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"La principal característica humana es la tontería"
(Augusto Monterroso)

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:50 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com