#1636 speedup for untagged_builds query
Closed: Fixed 3 years ago by tkopecek. Opened 5 years ago by tkopecek.

Currently there is

SELECT build.id, package.name, build.version, build.release
FROM build
    JOIN package on package.id = build.pkg_id
    LEFT OUTER JOIN tag_listing ON tag_listing.build_id = build.id
        AND tag_listing.active IS TRUE
WHERE tag_listing.tag_id IS NULL AND build.state = 1

Better option could be:

SELECT b.id, p.name, b.version, b.release
FROM build b, package p
WHERE
    NOT EXISTS
        (SELECT 1 FROM tag_listing tl
         WHERE tl.build_id = b.id
             AND tl.active = TRUE
        )
    AND p.id = b.pkg_id
    AND b.state = 1

I'm getting half time compared to current query (2.4s vs 4.4s). It probably could be still better.


Metadata Update from @tkopecek:
- Custom field Size adjusted to None
- Issue set to the milestone: 1.26

3 years ago

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.27 (was: 1.26)

3 years ago

Metadata Update from @jcupova:
- Issue tagged with: testing-ready

3 years ago

Metadata Update from @jcupova:
- Issue tagged with: testing-done

3 years ago

Log in to comment on this ticket.

Metadata
Related Pull Requests
  • #3005 Merged 3 years ago