This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://manishrjain.com/zfs-raid-ubuntu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Create Employees table | |
| CREATE TABLE Employees ( | |
| EmployeeID SERIAL PRIMARY KEY, | |
| FirstName VARCHAR(50), | |
| LastName VARCHAR(50), | |
| Department VARCHAR(50), | |
| Salary NUMERIC(10, 2) | |
| ); | |
| CREATE TABLE Employees2 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| postgres@pg:~/udemy/15/project$ initdb -D db1 >/dev/null 2>/dev/null | |
| postgres@pg:~/udemy/15/project$ cp postgresql.auto.conf_db1 db1/postgresql.auto.conf | |
| postgres@pg:~/udemy/15/project$ vim db1/postgresql.auto.conf | |
| postgres@pg:~/udemy/15/project$ pg_ctl -D db1 -l db1.log start | |
| waiting for server to start.... done | |
| server started | |
| postgres@pg:~/udemy/15/project$ psql -c 'create table t(col1 int); insert into t select generate_series(1, 10000) x;' | |
| CREATE TABLE | |
| INSERT 0 10000 | |
| postgres@pg:~/udemy/15/project$ psql -c 'checkpoint' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections; | |
| using Npgsql; | |
| namespace Program | |
| { | |
| class Program | |
| { | |
| static async Task Main(string[] args) // without async task main, cannot use await |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- | |
| -- Befor using it you should enable dblink extension in database and allow user to run dblink_connect_u | |
| -- You may need to change 'dbname=osm' to your db connection options in line 34. | |
| -- CREATE EXTENSION dblink; | |
| -- GRANT EXECUTE ON FUNCTION dblink_connect_u(text) TO user; | |
| -- GRANT EXECUTE ON FUNCTION dblink_connect_u(text, text) TO user; | |
| -- | |
| DROP FUNCTION IF EXISTS public.g_parsel(query text, table_to_chunk text, num_chunks integer); | |
| CREATE OR REPLACE FUNCTION public.g_parsel(query text, table_to_chunk text, num_chunks integer default 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://itecnote.com/tecnote/postgresql-can-a-postgres-commit-exist-in-procedure-that-has-an-exception-block/ | |
| https://github.com/postgres/postgres/blob/REL_14_STABLE/src/pl/plpgsql/src/expected/plpgsql_transaction.out | |
| There are parts of the procedure where I might want to commit my work so-far so that it won't be rolled back if an exceptions ensues. | |
| I want to have an exception handling block at the end of the procedure where I catch the exception | |
| and insert the information from the exception into a logging table. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| consistent hashing using fnv and murmur3 | |
| https://github.com/flier/pyfasthash | |
| https://github.com/amutu/fnvhash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| citusdb=# select * from pg_timezone_names limit 1; | |
| name | abbrev | utc_offset | is_dst | |
| ------------+--------+------------+-------- | |
| Etc/GMT-12 | +12 | 12:00:00 | f | |
| (1 row) | |
| citusdb=# select current_timestamp at time zone 'UTC'; | |
| timezone | |
| --------------------------- | |
| 2023-11-20 09:59:05.33791 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- port 5432 | |
| drop publication db1 ; | |
| drop subscription db12; | |
| drop subscription db13; | |
| drop table t; | |
| create table t(id int primary key); | |
| create publication db1 for all tables WITH ( PUBLISH = 'insert,update,delete,truncate' ); | |
| CREATE SUBSCRIPTION db12 connection 'dbname=postgres port=5433 host=localhost user=postgres' publication db2 WITH (origin = none, copy_data = | |
| off); | |
| CREATE SUBSCRIPTION db13 connection 'dbname=postgres port=5434 host=localhost user=postgres' publication db3 WITH (origin = none, copy_data = |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| why pg_repack will not do online data migration | |
| https://github.com/reorg/pg_repack/pull/162 |