postgresqlcommands
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
postgresqlcommands [2022/06/07 09:00] – [Useful SQL Commands] z0hpvk | postgresqlcommands [2025/04/17 10:16] (current) – z0hpvk | ||
---|---|---|---|
Line 1: | Line 1: | ||
==== Installation ==== | ==== Installation ==== | ||
- | === Ubuntu | + | === Linux === |
- | [[https:// | + | [[https:// |
+ | [[https:// | ||
=== Create Cluster === | === Create Cluster === | ||
- | The installation | + | The Debian or Ubuntu |
- | If you wish to create a new one run the following command as postgres | + | Create |
+ | <code bash> | ||
+ | # Debian / Ubuntu | ||
+ | pg_createcluster -d / | ||
+ | |||
+ | # Redhat / Fedora | ||
+ | # Default Data Directory: / | ||
+ | sudo / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | === Instance Details === | ||
< | < | ||
- | pg_createcluster | + | / |
+ | / | ||
+ | /usr/ | ||
</ | </ | ||
Line 178: | Line 192: | ||
-- Populate table with random Ids | -- Populate table with random Ids | ||
- | CREATE TABLE T1 (id integer); | + | CREATE TABLE t1 (id integer); |
- | INSERT INTO T1 SELECT * FROM generate_series(1, | + | INSERT INTO t1 SELECT * FROM generate_series(1, |
+ | |||
+ | CREATE TABLE t2 (id integer, description text, updated timestamptz); | ||
+ | INSERT INTO t2 | ||
+ | SELECT floor(random()*(100-1+1))+1 AS random_number, | ||
+ | | ||
+ | now() - INTERVAL '1 year' + random() * (now() - now() - INTERVAL '1 year') AS random_timestamp | ||
+ | FROM generate_series(1, | ||
-- Reload postgresql.conf and pg_hba.conf Files | -- Reload postgresql.conf and pg_hba.conf Files |
postgresqlcommands.1654592454.txt.gz · Last modified: 2025/03/08 22:23 (external edit)