Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-3220

resource_events_resource_type_idx should be removed because it's unused and duplicates resource_events_resource_timestamp

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDB 4.4.0
    • Component/s: None
    • Labels:
    • Template:
    • QA Risk Assessment:
      Needs Assessment

      Description

      The Problem

      \d+ resource_events
      ...
      Indexes:
       ...
          "resource_events_resource_timestamp" btree (resource_type, resource_title, "timestamp")
      ...
          "resource_events_resource_type_idx" btree (resource_type)
      

      The database can execute the same searches on the timestamp index because they both have the same primary column. An argument for keeping the resource_type index would be if the timestamp index were significantly larger and wasn't as fast to search since it has the each column data in it. However, based on some pdb-summary-stats data I have it appears the resource_type_idx is never used because the optimizer must prefer the timestamp index for some reason.

      We could confirm with more summary stats data but if the usage of the resource_types index is low then having queries use the timestamp index should be of marginal difference.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                nick.walker Nick Walker
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: