Skip to content

Commit 963052f

Browse files
committed
feat: unique index hypertable
1 parent 32d0511 commit 963052f

File tree

8 files changed

+10
-15
lines changed

8 files changed

+10
-15
lines changed

compose.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ services:
4444
dockerfile: infra/pragma-node/Dockerfile
4545

4646
db:
47-
image: timescale/timescaledb:1.7.4-pg12
47+
image: timescale/timescaledb-ha:pg14-latest
4848
restart: always
4949
user: postgres
5050
secrets:
@@ -61,7 +61,7 @@ services:
6161
expose:
6262
- 5432
6363
healthcheck:
64-
test: ["CMD", "pg_isready"]
64+
test: [ "CMD", "pg_isready" ]
6565
interval: 10s
6666
timeout: 5s
6767
retries: 5
@@ -102,7 +102,7 @@ services:
102102
"kafka-topics",
103103
"--list",
104104
"--bootstrap-server",
105-
"pragma-kafka:9092",
105+
"pragma-kafka:9092"
106106
]
107107
environment:
108108
KAFKA_BROKER_ID: 1
@@ -153,6 +153,7 @@ volumes:
153153
pragma_zookeeper_data:
154154
pragma_zookeeper_logs:
155155

156+
156157
secrets:
157158
db-password:
158159
file: infra/db/password.txt

pragma-entities/migrations/2023-11-18-131303_add_entries_index/down.sql

-2
This file was deleted.

pragma-entities/migrations/2023-11-18-131303_add_entries_index/up.sql

-2
This file was deleted.

pragma-entities/migrations/2023-11-18-143139_add_composite_index/down.sql

-2
This file was deleted.

pragma-entities/migrations/2023-11-18-143139_add_composite_index/up.sql

-2
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
-- This file should undo anything in `up.sql`
2-
DROP INDEX IF EXISTS idx_entries_source;
2+
DROP INDEX IF EXISTS idx_entries_unique;
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-- Your SQL goes here
2-
DROP INDEX IF EXISTS idx_entries_publisher_source_timestamp;
3-
CREATE INDEX idx_entries_source ON entries(source);
2+
CREATE UNIQUE INDEX idx_entries_unique
3+
ON entries(pair_id, source, timestamp);
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
-- Your SQL goes here
2-
SELECT create_hypertable('entries', 'timestamp');
2+
SELECT create_hypertable('entries', by_range('timestamp'));
3+
SELECT * FROM add_dimension('entries', by_hash('pair_id', 4))
4+
SELECT * FROM add_dimension('entries', by_hash('source', 4))

0 commit comments

Comments
 (0)