{"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": "Unique (cost=1113832.05..1216625.17 rows=788550 width=90)\n Output: ((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 Merge (cost=1113827.59..1210706.59 rows=788550 width=90)\n Output: ((current_keyword.e)::text), current_text.v, ((current_long.v)::text)\n Workers Planned: 7\n Params Evaluated: $0, $1, $2\n -> Sort (cost=1112827.47..1113109.09 rows=112650 width=90)\n Output: ((current_keyword.e)::text), current_text.v, ((current_long.v)::text)\n Sort Key: ((current_keyword.e)::text), current_text.v, ((current_long.v)::text)\n -> Nested Loop (cost=648255.46..1103375.29 rows=112650 width=90)\n Output: (current_keyword.e)::text, current_text.v, (current_long.v)::text\n Join Filter: (current_keyword.e = current_long.e)\n -> Parallel Hash Join (cost=648254.90..921876.79 rows=282803 width=42)\n Output: current_keyword.e, current_text.v, current_text.e\n Inner Unique: true\n Hash Cond: (current_text.e = current_keyword.e)\n -> Parallel Index Only Scan using idx_current_text_aev on mentat.current_text (cost=0.56..269778.45 rows=1464384 width=34)\n Output: current_text.store_id, current_text.a, current_text.e, current_text.v, current_text.tx\n Index Cond: ((current_text.store_id = '0'::bigint) AND (current_text.a = $2))\n -> Parallel Hash (cost=631757.48..631757.48 rows=1319748 width=8)\n Output: current_keyword.e\n -> Parallel Seq Scan on mentat.current_keyword (cost=0.00..631757.48 rows=1319748 width=8)\n Output: current_keyword.e\n Filter: ((current_keyword.store_id = '0'::bigint) AND (current_keyword.a = $0) AND (current_keyword.v = 'state/open'::text))\n -> Index Only Scan using current_long_pkey on mentat.current_long (cost=0.56..0.63 rows=1 width=16)\n Output: current_long.store_id, current_long.e, current_long.a, current_long.v\n Index Cond: ((current_long.store_id = '0'::bigint) AND (current_long.e = current_text.e) AND (current_long.a = $1) AND (current_long.v >= '4'::bigint))\nQuery Identifier: 5193902301762979270", "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) 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) 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) 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)"}