{"datalog_plan": {"patterns": [{"idx": 0, "table": "mentat.datoms_keyword_new", "attribute": ":issue/state", "variables": {"entity": "?i"}}, {"idx": 1, "table": "mentat.datoms_long_new", "attribute": ":issue/priority", "variables": {"value": "?priority", "entity": "?i"}}, {"idx": 2, "table": "mentat.datoms_text_new", "attribute": ":issue/title", "variables": {"value": "?title", "entity": "?i"}}], "complexity": {"cte": false, "joins": 3, "union_all": false, "aggregates": false}, "predicates": ["[(>= Variable(var(?priority)) Variable(var(?min)))]"], "not_clauses": 0, "or_branches": 0, "join_variables": ["?i"], "ground_bindings": {}, "where_functions": []}, "explain_plan": "HashAggregate (cost=43091.06..45118.20 rows=101357 width=88)\n Output: ((current_keyword.e)::text), current_text.v, ((current_long.v)::text)\n Group Key: ((current_keyword.e)::text), current_text.v, ((current_long.v)::text)\n InitPlan 1 (returns $0)\n -> Seq Scan on mentat.schema (cost=0.00..1.49 rows=1 width=8)\n Output: schema.entid\n Filter: (schema.ident = ':issue/state'::text)\n InitPlan 2 (returns $1)\n -> Seq Scan on mentat.schema schema_1 (cost=0.00..1.49 rows=1 width=8)\n Output: schema_1.entid\n Filter: (schema_1.ident = ':issue/priority'::text)\n InitPlan 3 (returns $2)\n -> Seq Scan on mentat.schema schema_2 (cost=0.00..1.49 rows=1 width=8)\n Output: schema_2.entid\n Filter: (schema_2.ident = ':issue/title'::text)\n -> Gather (cost=7738.80..42326.42 rows=101357 width=88)\n Output: ((current_keyword.e)::text), current_text.v, ((current_long.v)::text)\n Workers Planned: 4\n Params Evaluated: $0, $1, $2\n -> Result (cost=6738.80..31190.72 rows=25339 width=88)\n Output: (current_keyword.e)::text, current_text.v, (current_long.v)::text\n One-Time Filter: (($0 = 1000004) AND ($1 = 1000005) AND ($2 = 1000003))\n -> Nested Loop (cost=6738.80..30937.33 rows=25339 width=40)\n Output: current_keyword.e, current_long.v, current_text.v\n -> Parallel Hash Join (cost=6738.36..18329.16 rows=25568 width=24)\n Output: current_keyword.e, current_long.v, current_long.e\n Inner Unique: true\n Hash Cond: (current_long.e = current_keyword.e)\n -> Parallel Index Only Scan using idx_current_long_avet on mentat.current_long (cost=0.43..11250.72 rows=129718 width=16)\n Output: current_long.store_id, current_long.a, current_long.v, current_long.e\n Index Cond: ((current_long.store_id = '0'::bigint) AND (current_long.a = 1000005) AND (current_long.v >= '4'::bigint))\n -> Parallel Hash (cost=5937.21..5937.21 rows=64058 width=8)\n Output: current_keyword.e\n -> Parallel Index Only Scan using idx_current_keyword_avet on mentat.current_keyword (cost=0.43..5937.21 rows=64058 width=8)\n Output: current_keyword.e\n Index Cond: ((current_keyword.store_id = '0'::bigint) AND (current_keyword.a = 1000004) AND (current_keyword.v = 'state/open'::text))\n -> Index Only Scan using current_text_pkey on mentat.current_text (cost=0.43..0.48 rows=1 width=32)\n Output: current_text.store_id, current_text.e, current_text.a, current_text.v\n Index Cond: ((current_text.store_id = '0'::bigint) AND (current_text.e = current_long.e) AND (current_text.a = 1000003))\nQuery Identifier: -8918598826395827327", "datalog_query": "[:find ?i ?title ?priority :in $ ?min :where [?i :issue/state :state/open] [?i :issue/priority ?priority] [?i :issue/title ?title] [(>= ?priority ?min)]]", "generated_sql": "SELECT DISTINCT datoms0.e::TEXT, CASE datoms2.value_type_tag WHEN 0 THEN datoms2.v_ref::TEXT WHEN 1 THEN datoms2.v_bool::TEXT WHEN 2 THEN datoms2.v_long::TEXT WHEN 3 THEN 'd:' || ('x' || encode(float8send(datoms2.v_double), 'hex'))::bit(64)::bigint::TEXT WHEN 4 THEN to_char(datoms2.v_instant AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') WHEN 7 THEN datoms2.v_text WHEN 8 THEN ':' || datoms2.v_keyword WHEN 10 THEN datoms2.v_uuid::TEXT WHEN 11 THEN encode(datoms2.v_bytes, 'hex') ELSE NULL::TEXT END, CASE datoms1.value_type_tag WHEN 0 THEN datoms1.v_ref::TEXT WHEN 1 THEN datoms1.v_bool::TEXT WHEN 2 THEN datoms1.v_long::TEXT WHEN 3 THEN 'd:' || ('x' || encode(float8send(datoms1.v_double), 'hex'))::bit(64)::bigint::TEXT WHEN 4 THEN to_char(datoms1.v_instant AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') WHEN 7 THEN datoms1.v_text WHEN 8 THEN ':' || datoms1.v_keyword WHEN 10 THEN datoms1.v_uuid::TEXT WHEN 11 THEN encode(datoms1.v_bytes, 'hex') ELSE NULL::TEXT END FROM (SELECT e, a, 8::SMALLINT AS value_type_tag, NULL::BIGINT AS v_ref, NULL::BOOLEAN AS v_bool, NULL::BIGINT AS v_long, NULL::DOUBLE PRECISION AS v_double, NULL::TEXT AS v_text, v AS v_keyword, NULL::TIMESTAMPTZ AS v_instant, NULL::UUID AS v_uuid, NULL::BYTEA AS v_bytes, tx, true AS added FROM mentat.current_keyword WHERE store_id = $1 AND a = 1000004) AS datoms0, (SELECT e, a, 2::SMALLINT AS value_type_tag, NULL::BIGINT AS v_ref, NULL::BOOLEAN AS v_bool, v AS v_long, NULL::DOUBLE PRECISION AS v_double, NULL::TEXT AS v_text, NULL::TEXT AS v_keyword, NULL::TIMESTAMPTZ AS v_instant, NULL::UUID AS v_uuid, NULL::BYTEA AS v_bytes, tx, true AS added FROM mentat.current_long WHERE store_id = $1 AND a = 1000005) AS datoms1, (SELECT e, a, 7::SMALLINT AS value_type_tag, NULL::BIGINT AS v_ref, NULL::BOOLEAN AS v_bool, NULL::BIGINT AS v_long, NULL::DOUBLE PRECISION AS v_double, v AS v_text, NULL::TEXT AS v_keyword, NULL::TIMESTAMPTZ AS v_instant, NULL::UUID AS v_uuid, NULL::BYTEA AS v_bytes, tx, true AS added FROM mentat.current_text WHERE store_id = $1 AND a = 1000003) AS datoms2 WHERE datoms0.a = (SELECT entid FROM mentat.schema WHERE ident = $2) AND (datoms0.v_keyword = $3 AND datoms0.value_type_tag = 8) AND datoms0.added = true AND datoms1.e = datoms0.e AND datoms1.a = (SELECT entid FROM mentat.schema WHERE ident = $4) AND datoms1.added = true AND datoms2.e = datoms0.e AND datoms2.a = (SELECT entid FROM mentat.schema WHERE ident = $5) AND datoms2.added = true AND (datoms1.v_long >= $6)"}