Обсуждение: looking for doc

Поиск
Список
Период
Сортировка

looking for doc

От
Kasia Tuszynska
Дата:
Admins,
I am looking for doc that defines the differences between template 1 and template 0. Specifically, I am looking for a
discussionon the presence of admin tasks in template 1 and lack of admin tasks ( such as vacuum) in template 0. I am
notable to find doc on this, maybe I am remembering something that is no longer the case. 

Thank you,
Kasia


Re: looking for doc

От
Ian Lawrence Barwick
Дата:
2014-03-18 6:37 GMT+09:00 Kasia Tuszynska <ktuszynska@esri.com>:
> Admins,
> I am looking for doc that defines the differences between template 1 and template 0. Specifically, I am looking for a
discussionon the presence of admin tasks in template 1 and lack of admin tasks ( such as vacuum) in template 0. I am
notable to find doc on this, maybe I am remembering something that is no longer the case. 

Is this useful for you?

    http://www.postgresql.org/docs/current/interactive/manage-ag-templatedbs.html

Regards

Ian Barwick


Re: looking for doc

От
Kasia Tuszynska
Дата:
Ian,
Thanks that is the really only doc that comes up when I search for this. It discusses how to call a template to create
anew db, but it does not list the differences between them. I am going to try to just find a definition of both.
 
Thanks,
Kasia 

-----Original Message-----
From: Ian Lawrence Barwick [mailto:barwick@gmail.com] 
Sent: Monday, March 17, 2014 2:52 PM
To: Kasia Tuszynska
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] looking for doc

2014-03-18 6:37 GMT+09:00 Kasia Tuszynska <ktuszynska@esri.com>:
> Admins,
> I am looking for doc that defines the differences between template 1 and template 0. Specifically, I am looking for a
discussionon the presence of admin tasks in template 1 and lack of admin tasks ( such as vacuum) in template 0. I am
notable to find doc on this, maybe I am remembering something that is no longer the case.
 

Is this useful for you?

    http://www.postgresql.org/docs/current/interactive/manage-ag-templatedbs.html

Regards

Ian Barwick


Re: looking for doc

От
Ian Lawrence Barwick
Дата:
2014-03-18 6:54 GMT+09:00 Kasia Tuszynska <ktuszynska@esri.com>:
> Ian,
> Thanks that is the really only doc that comes up when I search for this. It discusses how to call a template to
createa new db, but it does not list the differences between them. I am going to try to just find a definition of both. 

Basically, "template1" is the default template used for creating new databases.
Normally template1 and template0 are identical, however it's possible
to customise
template1 if there are some modifications you wish to  have automatically in
all new databases:

    template1=# CREATE LANGUAGE plperlu;
    CREATE LANGUAGE
    Time: 1033.037 ms
    template1=# CREATE DATABASE foo;
    CREATE DATABASE
    Time: 3267.212 ms
    template1=# \c foo
    You are now connected to database "foo" as user "barwick".
    foo=# \dL
                         List of languages
      Name   |  Owner  | Trusted |         Description
    ---------+---------+---------+------------------------------
     plperlu | barwick | f       |
     plpgsql | barwick | t       | PL/pgSQL procedural language
    (2 rows)


template0 cannot be changed and serves as a "backup" if you need
to restore template1, or create a new database without the customisations
in template1.

Regards

Ian Barwick


Re: looking for doc

От
David Johnston
Дата:
Kasia Tuszynska wrote
> Ian,
> Thanks that is the really only doc that comes up when I search for this.
> It discusses how to call a template to create a new db, but it does not
> list the differences between them. I am going to try to just find a
> definition of both.
> Thanks,
> Kasia
>
> -----Original Message-----
> From: Ian Lawrence Barwick [mailto:

> barwick@

> ]
> Sent: Monday, March 17, 2014 2:52 PM
> To: Kasia Tuszynska
> Cc:

> pgsql-admin@

> Subject: Re: [ADMIN] looking for doc
>
> 2014-03-18 6:37 GMT+09:00 Kasia Tuszynska <

> ktuszynska@

> >:
>> Admins,
>> I am looking for doc that defines the differences between template 1 and
>> template 0. Specifically, I am looking for a discussion on the presence
>> of admin tasks in template 1 and lack of admin tasks ( such as vacuum) in
>> template 0. I am not able to find doc on this, maybe I am remembering
>> something that is no longer the case.
>
> Is this useful for you?
>
>
> http://www.postgresql.org/docs/current/interactive/manage-ag-templatedbs.html
>
> Regards
>
> Ian Barwick

The only difference between them is semantic.  In fact, as that page says
explicitly, at cluster creation time they are identical.

I will paraphrase the first two paragraphs to see if you understand it
better:

template0 is created upon cluster initialization and should never be
altered.  As a practical matter template1 is then created as a clone of
template0.  The purpose of template1 is to allow for the issuance of an
implicit "CREATE DATABASE %dbname% TEMPLATE = 'template1';" since template1
is the default template and all database creation occurs via template
copying.

Admins can alter template1 to include custom stuff that will then be present
in any database created from it while leaving template0 available for those
situation where those customizations in template1 are not desired (i.e,
CREATE DATABASE dbname0 TEMPLATE = 'template0';)

i do not get what you mean by "admin tasks in template1, not in template0".
If you mean why (assuming you are correct) doesn't the system VACUUM
template0 that would be because it should never change and thus never
require such maintenance.  Since template1 can change it does require
maintenance.

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/looking-for-doc-tp5796445p5796459.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


Re: looking for doc

От
David Johnston
Дата:
David Johnston wrote
> i do not get what you mean by "admin tasks in template1, not in
> template0".  If you mean why (assuming you are correct) doesn't the system
> VACUUM template0 that would be because it should never change and thus
> never require such maintenance.  Since template1 can change it does
> require maintenance.

If you are referring to instructions to perform cluster-wide maintenance
(i.e., create data, create role) while connected to the "template1" database
that it mostly a matter of convenience.  template0 should not be used (if it
even can be connected to) for administrative tasks because template1 has to
exist and is better suited from a logical standpoint to fulfill that role.
The postgres default database is also a viable candidate but often people
will drop it if they feel it is not useful.

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/looking-for-doc-tp5796445p5796462.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


Re: looking for doc

От
Kasia Tuszynska
Дата:
Thanks David,
I must have remembered something wrong.
I thought I remembered that one of the differences between template 1 and template 0 was that when a db was created
withtemplate0 that autovacuum was switched off.  
I know that it autovacuum is controlled in the postgresql.conf file but for some reason I thought that the .conf
behaviorcan be overwritten with template 0 and thus it would be unadvisable to recommend dbs created based on template
0to non admin minded administrators of Postgres. But I cannot find any doc that describes this behavior and I cannot
findany such parameter in the pg_catalog tables. 
So, at this point I am going to chock it up to faulty user memory.
Thanks,
Kasia

-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of David Johnston
Sent: Monday, March 17, 2014 3:26 PM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] looking for doc

Kasia Tuszynska wrote
> Ian,
> Thanks that is the really only doc that comes up when I search for this.
> It discusses how to call a template to create a new db, but it does
> not list the differences between them. I am going to try to just find
> a definition of both.
> Thanks,
> Kasia
>
> -----Original Message-----
> From: Ian Lawrence Barwick [mailto:

> barwick@

> ]
> Sent: Monday, March 17, 2014 2:52 PM
> To: Kasia Tuszynska
> Cc:

> pgsql-admin@

> Subject: Re: [ADMIN] looking for doc
>
> 2014-03-18 6:37 GMT+09:00 Kasia Tuszynska <

> ktuszynska@

> >:
>> Admins,
>> I am looking for doc that defines the differences between template 1
>> and template 0. Specifically, I am looking for a discussion on the
>> presence of admin tasks in template 1 and lack of admin tasks ( such
>> as vacuum) in template 0. I am not able to find doc on this, maybe I
>> am remembering something that is no longer the case.
>
> Is this useful for you?
>
>
> http://www.postgresql.org/docs/current/interactive/manage-ag-templated
> bs.html
>
> Regards
>
> Ian Barwick

The only difference between them is semantic.  In fact, as that page says explicitly, at cluster creation time they are
identical.

I will paraphrase the first two paragraphs to see if you understand it
better:

template0 is created upon cluster initialization and should never be altered.  As a practical matter template1 is then
createdas a clone of template0.  The purpose of template1 is to allow for the issuance of an implicit "CREATE DATABASE
%dbname%TEMPLATE = 'template1';" since template1 is the default template and all database creation occurs via template
copying.  

Admins can alter template1 to include custom stuff that will then be present in any database created from it while
leavingtemplate0 available for those situation where those customizations in template1 are not desired (i.e, CREATE
DATABASEdbname0 TEMPLATE = 'template0';) 

i do not get what you mean by "admin tasks in template1, not in template0".
If you mean why (assuming you are correct) doesn't the system VACUUM
template0 that would be because it should never change and thus never require such maintenance.  Since template1 can
changeit does require maintenance. 

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/looking-for-doc-tp5796445p5796459.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



Re: looking for doc

От
Kasia Tuszynska
Дата:
David J,
If the whole purpose of a template is to be a basis for an additional user database than what admi tasks are defined in
template1 and template 0 does matter, because if template 0 would never be used as a db in it's own right, it's
descendantswould be.  
For instance:
Template 0 does not contain the language encodings and collation settings specific to the os on which postgres is
runningtemplate 1 does, so if you want to create a db with language settings other than what is in template 1 you would
usetemplate 0, and if template 0 does not contain "admin tasks" than it would have to be administered manually.... 

Sincerely,
Kasia

-----Original Message-----
From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org] On Behalf Of David Johnston
Sent: Monday, March 17, 2014 3:33 PM
To: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] looking for doc

David Johnston wrote
> i do not get what you mean by "admin tasks in template1, not in
> template0".  If you mean why (assuming you are correct) doesn't the
> system VACUUM template0 that would be because it should never change
> and thus never require such maintenance.  Since template1 can change
> it does require maintenance.

If you are referring to instructions to perform cluster-wide maintenance (i.e., create data, create role) while
connectedto the "template1" database that it mostly a matter of convenience.  template0 should not be used (if it even
canbe connected to) for administrative tasks because template1 has to exist and is better suited from a logical
standpointto fulfill that role.  
The postgres default database is also a viable candidate but often people will drop it if they feel it is not useful.

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/looking-for-doc-tp5796445p5796462.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.


--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



Re: looking for doc

От
David Johnston
Дата:
> David J,
> If the whole purpose of a template is to be a basis for an additional user
> database than what admi tasks are defined in template 1 and template 0
> does matter, because if template 0 would never be used as a db in it's own
> right, it's descendants would be.
> For instance:
> Template 0 does not contain the language encodings and collation settings
> specific to the os on which postgres is running template 1 does, so if you
> want to create a db with language settings other than what is in template
> 1 you would use template 0, and if template 0 does not contain "admin
> tasks" than it would have to be administered manually....

Vacuum is not defined "in" a database; it is a system operation that acts
"on" databases.  It has been told that the database named "template0" is
special and to not waste time on it.

As with any database you can "ALTER DATABASE SET guc = 'value';" though
again you shouldn't do that for template0 and I'm not sure such changes are
copied to new databases if applied to template1.

Language and collation can both be overridden during database creation if
you want something different than what template1 uses.

If you want to continue this discussion please define "admin tasks" (or give
more examples) more completely.  If the only thing you can come up with is
"vacuum" then just say "vacuum".

David J.




--
View this message in context: http://postgresql.1045698.n5.nabble.com/looking-for-doc-tp5796445p5796620.html
Sent from the PostgreSQL - admin mailing list archive at Nabble.com.