PostgreSQL default and Template databases

  Рет қаралды 3,217

Ravi Nandigam

Ravi Nandigam

Күн бұрын

This video talks about default PostgreSQL database server. Below is the notes used in this recording:
***
Three default databases:
1) Postgres: User database
2) Template0: Template database. but, please don't drop this database
3) Template1: Is modifiable. You can drop this. And copy back from Template0.
a) Database location: $PGDATA/base/
b) Creation of a basic database
create database testdb1;
c) drop template1 database:
UPDATE pg_database SET datistemplate = 'f' WHERE datname = 'template1';
DROP DATABASE template1;
d) recreate template1 database:
CREATE DATABASE template1 TEMPLATE = template0 IS_TEMPLATE = 1;
e) psql -E : To display backend queries of backslash/metadata commands
f) pg_database: metadata table
g) Query to display database information:
SELECT d.datname as "Name",
pg_catalog.pg_get_userbyid(d.datdba) as "Owner",
pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding",
d.datcollate as "Collate",
d.datctype as "Ctype",
pg_catalog.array_to_string(d.datacl, E'
') AS "Access privileges"
FROM pg_catalog.pg_database d
ORDER BY 1;
***

Пікірлер: 3
@gbaski
@gbaski 3 жыл бұрын
I was just looking for this, applicable for a multi-tenant product database architecture, Thanks.
@muhammadsohailnisar6600
@muhammadsohailnisar6600 3 жыл бұрын
Thanks for such a nice lecture.
@oleksiistri8429
@oleksiistri8429 3 жыл бұрын
This was very informative. Thank You!
Connect to PostgreSQL from Python
19:03
Ravi Nandigam
Рет қаралды 927
How do indexes make databases read faster?
23:25
Arpit Bhayani
Рет қаралды 57 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 4,3 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 11 МЛН
Mastering Tablespaces in PostgreSQL: Boost Performance & Efficiency
5:09
Chat with SQL and Tabular Databases using LLM Agents (DON'T USE RAG!)
58:54
Why The Windows Phone Failed
24:08
Apple Explained
Рет қаралды 228 М.
Database Sharding and Partitioning
23:53
Arpit Bhayani
Рет қаралды 74 М.
Database Indexing Explained (with PostgreSQL)
18:19
Hussein Nasser
Рет қаралды 301 М.
How to build a FastAPI app with PostgreSQL
27:37
Eric Roby
Рет қаралды 42 М.
Why do databases store data in B+ trees?
29:43
Arpit Bhayani
Рет қаралды 33 М.
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 22 М.
PostgreSQL CRASH COURSE - Learn PostgreSQL in 2024
50:26
Troy Amelotte
Рет қаралды 215 М.