def findUnreferencedTroves(self):
        cu = self.db.cursor()
        cu.execute("""
                SELECT troveName, version, flavor FROM Instances
                    LEFT OUTER JOIN TroveTroves ON
                        Instances.instanceId = TroveTroves.includedId
                    JOIN Versions ON
                        Instances.versionId = Versions.versionId
                    JOIN Flavors ON
                        Instances.flavorId = Flavors.flavorId
                    WHERE
                        includedid IS NULL AND
                        version NOT LIKE "%/local@LOCAL:%"
        """)

        l = []
        for (name, version, flavorStr) in cu:
            if flavorStr is None:
                flavorStr = deps.deps.Flavor()
            else:
                flavorStr = deps.deps.ThawFlavor(flavorStr)

            l.append((name, versions.VersionFromString(version), flavorStr))

        return l