Cosette icon indicating copy to clipboard operation
Cosette copied to clipboard

EXISTS with subquery runs into out of time

Open matthiastz opened this issue 5 years ago • 1 comments

setup:

schema TrackSchema(TrackId: int, Name: varchar, AlbumId: int,
		MediaTypeId: int, GenreId: int, Composer: varchar,
		Milliseconds: int, Bytes: int, UnitPrice: numeric); 
table Track(TrackSchema);
schema GenreSchema(GenreId: int, Name: varchar); 
table Genre(GenreSchema);

query q1
`SELECT t.TrackId, t.Name, t.GenreId 
FROM Track t
WHERE EXISTS
(SELECT g.GenreId FROM Genre g WHERE t.GenreId = g.GenreId AND (g.Name = 'Reggae' OR g.Name = 'Jazz'))`;

query q2
`SELECT t.TrackId, t.Name, t.GenreId 
FROM Track t
WHERE EXISTS
(SELECT g.GenreId FROM Genre g WHERE t.GenreId = g.GenreId AND g.Name = 'Reggae' OR g.Name = 'Jazz')`;

verify q1 q2;

result: Two queries' equivalence is unknown. Solver runs out of time.

matthiastz avatar Jan 02 '20 13:01 matthiastz

Interesting! Thanks for the issue.

stechu avatar Jan 02 '20 14:01 stechu