Skip to content

Commit f92ef04

Browse files
authored
feat: added indexes to make querying performant (#17)
1 parent 1a67b81 commit f92ef04

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
-- +goose Up
3+
4+
CREATE INDEX IF NOT EXISTS idx_trace_id ON spans (trace_id);
5+
CREATE INDEX IF NOT EXISTS idx_services_name ON services(name);
6+
CREATE INDEX IF NOT EXISTS idx_operations_name ON operations(name);
7+
CREATE INDEX IF NOT EXISTS idx_spans_operation_service ON spans(operation_id, service_id);
8+
CREATE INDEX IF NOT EXISTS idx_spans_start_duration ON spans(start_time, duration);
9+
CREATE INDEX IF NOT EXISTS idx_spans_start_time ON spans(start_time);
10+
CREATE INDEX IF NOT EXISTS idx_spans_duration ON spans(duration);
11+
12+
-- +goose Down
13+
14+
DROP INDEX idx_trace_id ON spans (trace_id);
15+
DROP INDEX idx_services_name ON services(name);
16+
DROP INDEX idx_operations_name ON operations(name);
17+
DROP INDEX idx_spans_operation_service ON spans(operation_id, service_id);
18+
DROP INDEX idx_spans_start_duration ON spans(start_time, duration);
19+
DROP INDEX idx_spans_start_time ON spans(start_time);
20+
DROP INDEX idx_spans_duration ON spans(duration);

0 commit comments

Comments
 (0)