Skip to content

Commit

Permalink
[C] Remove unused indices
Browse files Browse the repository at this point in the history
These indices are huge and not getting used by the query planner.
  • Loading branch information
scryptmouse committed Dec 12, 2024
1 parent 0a267aa commit 7db05e5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

class RemoveUnusedTextSectionNodeIndices < ActiveRecord::Migration[6.1]
def up
execute <<~SQL
DROP INDEX IF EXISTS index_text_section_nodes_pairing;
DROP INDEX IF EXISTS index_text_section_nodes_on_node_path;
DROP INDEX IF EXISTS index_text_section_nodes_by_id_and_hash;
SQL
end

def down
# Intentionally left blank. We won't add these indices back.
end
end
24 changes: 2 additions & 22 deletions api/db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5576,13 +5576,6 @@ CREATE UNIQUE INDEX index_text_exports_uniqueness ON public.text_exports USING b
CREATE INDEX index_text_section_nodes_actual_ancestors ON public.text_section_nodes USING gist (node_path) WHERE (NOT intermediate);


--
-- Name: index_text_section_nodes_by_id_and_hash; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_text_section_nodes_by_id_and_hash ON public.text_section_nodes USING btree (text_section_id, body_hash);


--
-- Name: index_text_section_nodes_by_uuid; Type: INDEX; Schema: public; Owner: -
--
Expand All @@ -5604,27 +5597,13 @@ CREATE INDEX index_text_section_nodes_child_ordering ON public.text_section_node
CREATE INDEX index_text_section_nodes_extrapolation ON public.text_section_nodes USING btree (text_section_id, extrapolated_at);


--
-- Name: index_text_section_nodes_on_node_path; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_text_section_nodes_on_node_path ON public.text_section_nodes USING gist (node_path);


--
-- Name: index_text_section_nodes_on_text_section_id; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_text_section_nodes_on_text_section_id ON public.text_section_nodes USING btree (text_section_id);


--
-- Name: index_text_section_nodes_pairing; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_text_section_nodes_pairing ON public.text_section_nodes USING btree (node_path) INCLUDE (path);


--
-- Name: index_text_section_nodes_uniqueness; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -7194,6 +7173,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20231129172116'),
('20240220212417'),
('20240223163849'),
('20240327194259');
('20240327194259'),
('20241206175512');


0 comments on commit 7db05e5

Please sign in to comment.