aboutsummaryrefslogtreecommitdiff
path: root/content/posts/nested-postgres-results/setup.sql
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-09-29 18:42:44 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-10-01 07:51:11 +0200
commit637302a61ee9b4ef84e5c152a17af442599a8e2a (patch)
treec2ab4a8ce8e5abe97cfa8f3e3245d4ea7ec283df /content/posts/nested-postgres-results/setup.sql
parent415f7e954b021cad720c27ea73cadb3fb400e570 (diff)
Draft ready for PostgreSQL aggregation processing speed
Diffstat (limited to 'content/posts/nested-postgres-results/setup.sql')
-rw-r--r--content/posts/nested-postgres-results/setup.sql26
1 files changed, 0 insertions, 26 deletions
diff --git a/content/posts/nested-postgres-results/setup.sql b/content/posts/nested-postgres-results/setup.sql
deleted file mode 100644
index a54563b..0000000
--- a/content/posts/nested-postgres-results/setup.sql
+++ /dev/null
@@ -1,26 +0,0 @@
-CREATE TABLE accommodations (
- id serial PRIMARY KEY,
- name text NOT NULL,
- default_price numeric(10, 2) NOT NULL
-);
-
-INSERT INTO accommodations (name, default_price)
-SELECT
- CONCAT('accommodation_', generate_series) AS name,
- TRUNC(RANDOM() * 100 + 200) AS default_price
-FROM GENERATE_SERIES(1, 10000);
-
-CREATE TABLE overrides (
- id serial PRIMARY KEY,
- accommodation_id integer NOT NULL REFERENCES accommodations (id),
- date date NOT NULL,
- price numeric(10, 2) NOT NULL
-);
-ALTER TABLE overrides ADD constraint unique_dates UNIQUE (
- accommodation_id, date
-);
-INSERT INTO overrides (accommodation_id, date, price) SELECT
- (generate_series / 100) + 1 AS accommodation_id,
- '2025-01-01'::date + (generate_series % 100) * '3 days'::interval AS date,
- TRUNC(RANDOM() * 100 + 200) AS price
-FROM GENERATE_SERIES(1, 999999);