Bab 3 Basis Data Lanjut
Topik
3.1 Non-spatial SQL Queries
- Membuat tabel baru
Tujuan : Membuat tabel baru dari tabel yang sudah ada dengan kolom terpilih
CREATE TABLE kelurahan as SELECT geom, giskemen_2, giskemen_4, giskemen18,giskemen19,giskemen20,giskemen21, giskemen27, giskemen28 FROM public.desa_batam
- Rename column
Tujuan : Mengganti nama kolom tertentu
ALTER TABLE public.kelurahan RENAME COLUMN giskemen_2 TO nama_desa;
- Mengubah Primary Key
ALTER TABLE desa_batam DROP CONSTRAINT id;
ALTER TABLE desa_batam RENAME COLUMN giskemen_4 TO id;
ALTER TABLE desa_batam ADD PRIMARY KEY (id);
- Menambah Kolom
ALTER TABLE public.kelurahan ADD COLUMN giskemen33 FROM public.desa WHERE giskemen_4.public.desa.id = giskemen_4.public.kelurahan.id
3.2 Spatial SQL Queries
3.2.1 Adjacent
- Create New Layer
SELECT * into qlayer FROM kelurahan WHERE st_touches(kelurahan.geometry, ( SELECT geometry FROM kelurahan WHERE nama_desa = 'SADAI'))
- Create As View
CREATE VIEW TestView AS SELECT * FROM kelurahan WHERE st_touches(kelurahan.geom, ( SELECT geom FROM kelurahan WHERE nama_desa = 'SADAI'));
3.3 Backup dan Restore
Presentasi : https://gitpitch.com/firmanhadi/lapan-okt-19/master#/
Video Proof of Concept
- Backup dengan pgBarman
https://www.dropbox.com/s/tk2g296cc0pv6dh/backup_poc_v1.mkv?dl=0
- Pooling Mechanism
https://www.dropbox.com/s/nl3xa2bnlay6ppk/pooling_mechanism_poc_v1.mkv?dl=0
https://www.dropbox.com/s/dtugpqi6k8hcsc3/pooling_mechanism_poc_v2.mkv?dl=0
- Failover Mechanism
https://www.dropbox.com/s/j5f9ks21db18ebv/replication_failover_poc_v1.mkv?dl=0
Software