Skip to content

Commit

Permalink
fix(workflows): add idx
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterPtato committed Aug 9, 2024
1 parent d6faf4c commit db47fb6
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 0 deletions.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CREATE INVERTED INDEX ON db_cluster.servers (cloud_destroy_ts, pool_type2);
Empty file.
18 changes: 18 additions & 0 deletions svc/pkg/ds/db/servers/migrations/20240809224504_add_idx.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

CREATE INDEX ON db_dynamic_servers.servers (datacenter_id, stop_ts);

CREATE INDEX ON db_dynamic_servers.server_nomad (nomad_dispatched_job_id) STORING (nomad_alloc_plan_ts);
DROP INDEX db_dynamic_servers.server_nomad@server_nomad_nomad_dispatched_job_id_idx;

CREATE INDEX ON db_dynamic_servers.server_nomad (nomad_dispatched_job_id)
STORING (
nomad_alloc_id,
nomad_node_id,
nomad_alloc_plan_ts,
nomad_alloc_state,
nomad_eval_plan_ts,
nomad_node_name,
nomad_node_public_ipv4,
nomad_node_vlan_ipv4
);
DROP INDEX db_dynamic_servers.server_nomad@server_nomad_nomad_dispatched_job_id_idx;
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- Unused
DROP INDEX workflows@workflows_wake_deadline_ts_idx;
DROP INDEX workflows@workflows_wake_sub_workflow_id_idx;
DROP INDEX workflows@gin_workflows_wake_signals;

-- For forgetting events in `update_loop` fn
CREATE INDEX ON workflow_activity_events (loop_location) STORING (activity_name, input_hash, input, output, create_ts, forgotten);
CREATE INDEX ON workflow_loop_events (loop_location) STORING (iteration, output, forgotten);
CREATE INDEX ON workflow_message_send_events (loop_location) STORING (tags, message_name, body, forgotten);
CREATE INDEX ON workflow_signal_events (loop_location) STORING (signal_id, signal_name, body, ack_ts, forgotten);
CREATE INDEX ON workflow_signal_send_events (loop_location) STORING (signal_id, signal_name, body, forgotten);
CREATE INDEX ON workflow_sub_workflow_events (loop_location) STORING (sub_workflow_id, create_ts, forgotten);

-- For `pull_workflows` fn
CREATE INDEX ON signals (ack_ts) STORING (workflow_id, signal_name);
CREATE INDEX ON tagged_signals (ack_ts) STORING (tags, signal_name);
CREATE INDEX ON workflows (worker_instance_id)
STORING (
workflow_name, create_ts, ray_id, input, output, error, wake_immediate, wake_deadline_ts, wake_signals, wake_sub_workflow_id, tags
);
DROP INDEX workflows@workflows_worker_instance_id_idx;

-- For `workflow-gc`
CREATE INDEX ON db_workflow.worker_instances (last_ping_ts);

-- For `workflow-metrics-publish`
CREATE INDEX ON db_workflow.workflows (wake_deadline_ts, wake_sub_workflow_id, error)
STORING (workflow_name, output, wake_immediate, wake_signals);

0 comments on commit db47fb6

Please sign in to comment.