Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-24488

Avoid N+1 database queries in OSSIndex integration

    XMLWordPrintable

    Details

      Description

      The OSSIndex integration recently added in NEXUS-24288 means that the browse UI will now make an extra database query for every node on the page. This ends up being a classic "N+1" DB problem - where one query leads to N additional queries.

      These extra DB queries are used to get the full component details, but in practice only the component coordinates are needed to send to OSSIndex. These coordinates are set when the component is created and will not change over time. It's therefore feasible to store the component's PackageUrl (based on the "purl-spec" standard) in the browse node when the component is attached to the browse node.

      This would mean only one database query was needed for each browse UI page - because the returned browse nodes would already contain the package-url for sending to the OSSIndex service.

        Attachments

          Activity

            People

            Assignee:
            mjohnson Matt Johnson
            Reporter:
            mcculls Stuart McCulloch
            Last Updated By:
            Ophelia Hernandez
            Team:
            NXRM - Trinity
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                tigCommentSecurity.panel-title

                  PagerDuty