Skip to content

Is it normal for a query to take up forever (3-5 minutes, no response) #1796

Answered by elprans
isidentical asked this question in Q&A
Discussion options

You must be logged in to vote

array_agg(enumerate(.keys)) = [(((0), (SELECT ast::Constant)))

That's not how you check for the type of an object. Your query selects all Constant and Call objects from the database unconstrained and then performs the comparison X*Y times for every Dict object.

If you want to use equality instead of IS to test for types, you must compare with the schema::ObjectType instances instead, like this:

WITH
    Constant := (SELECT schema::ObjectType FILTER .name = 'ast::Constant'),
    Call := (SELECT schema::ObjectType FILTER .name = 'ast::Call')
SELECT
    ast::Dict
FILTER
    array_agg(.keys.__type__.id) = [Constant.id, Call.id];

However, there's another issue here: links are unordered, so …

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
7 replies
@elprans
Comment options

@isidentical
Comment options

@isidentical
Comment options

@elprans
Comment options

@isidentical
Comment options

Answer selected by isidentical
Comment options

You must be logged in to vote
1 reply
@isidentical
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants