Uploaded image for project: 'Razor (moved to puppet.atlassian.net)'
  1. Razor (moved to puppet.atlassian.net)
  2. RAZOR-520

Duplicate database index on nodes_tags

    XMLWordPrintable

Details

    • Bug
    • Status: Ready for Engineering
    • Normal
    • Resolution: Unresolved
    • None
    • None
    • Server

    Description

      The database schema for Razor sets up two indices on nodes_tags that are the same thing: since `002_create_base_schema` specifies `(node_id, tag_id)` as the pk for the table, the additional index on `(node_id, tag_id)` is redundant (the pk forces creation of such an index already)

      It might be useful for some queries to have the reverse index on `(tag_id, node_id)` instead.

      In Scope

      • Delete the duplicate "nodes_tags" index
      • Create a new index called "tags_nodes" on the reverse order of the index (tag_id, node_id)

      Current output:

      razor=# \d nodes_tags
         Table "public.nodes_tags"
       Column  |  Type   | Modifiers 
      ---------+---------+-----------
       node_id | integer | not null
       tag_id  | integer | not null
      Indexes:
          "nodes_tags_pkey" PRIMARY KEY, btree (node_id, tag_id)
          "nodes_tags_node_id_tag_id_index" btree (node_id, tag_id)
      Foreign-key constraints:
          "nodes_tags_node_id_fkey" FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE CASCADE
          "nodes_tags_tag_id_fkey" FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCADE 

      Attachments

        Activity

          People

            Unassigned Unassigned
            lutter David Lutterkort
            Sam Woods Sam Woods
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Zendesk Support