{"datalog_plan": {"patterns": [{"idx": 0, "table": "mentat.datoms_text_new", "attribute": ":user/email", "variables": {"value": "?email", "entity": "?u"}}, {"idx": 1, "table": "mentat.datoms_ref_new", "attribute": ":issue/assignee", "variables": {"value": "?u", "entity": "?i"}}, {"idx": 2, "table": "mentat.datoms_text_new", "attribute": ":issue/title", "variables": {"value": "?title", "entity": "?i"}}, {"idx": 3, "table": "mentat.datoms_keyword_new", "attribute": ":issue/state", "variables": {"value": "?state", "entity": "?i"}}], "complexity": {"cte": false, "joins": 4, "union_all": false, "aggregates": false}, "predicates": [], "not_clauses": 0, "or_branches": 0, "join_variables": ["?u", "?i"], "ground_bindings": {}, "where_functions": []}, "explain_plan": "Unique (cost=13.22..13.23 rows=1 width=88)\n Output: ((current_ref.e)::text), current_text_1.v, ((':'::text || current_keyword.v))\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 = ':user/email'::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/assignee'::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 InitPlan 4 (returns $3)\n -> Seq Scan on mentat.schema schema_3 (cost=0.00..1.49 rows=1 width=8)\n Output: schema_3.entid\n Filter: (schema_3.ident = ':issue/state'::text)\n -> Sort (cost=7.27..7.27 rows=1 width=88)\n Output: ((current_ref.e)::text), current_text_1.v, ((':'::text || current_keyword.v))\n Sort Key: ((current_ref.e)::text), current_text_1.v, ((':'::text || current_keyword.v))\n -> Result (cost=1.85..7.26 rows=1 width=88)\n Output: (current_ref.e)::text, current_text_1.v, (':'::text || current_keyword.v)\n One-Time Filter: (($0 = 1000001) AND ($1 = 1000006) AND ($2 = 1000003) AND ($3 = 1000004))\n -> Nested Loop (cost=1.85..7.25 rows=1 width=46)\n Output: current_ref.e, current_text_1.v, current_keyword.v\n -> Nested Loop (cost=1.41..6.77 rows=1 width=30)\n Output: current_ref.e, current_keyword.v, current_keyword.e\n -> Nested Loop (cost=0.98..6.30 rows=1 width=8)\n Output: current_ref.e\n -> Index Only Scan using idx_current_text_avet on mentat.current_text (cost=0.55..1.68 rows=1 width=8)\n Output: current_text.store_id, current_text.a, current_text.v, current_text.e\n Index Cond: ((current_text.store_id = '0'::bigint) AND (current_text.a = 1000001) AND (current_text.v = 'user0@example.com'::text))\n -> Index Only Scan using idx_current_ref_vae on mentat.current_ref (cost=0.43..3.67 rows=95 width=16)\n Output: current_ref.store_id, current_ref.v, current_ref.a, current_ref.e\n Index Cond: ((current_ref.store_id = '0'::bigint) AND (current_ref.v = current_text.e) AND (current_ref.a = 1000006))\n -> Index Only Scan using current_keyword_pkey on mentat.current_keyword (cost=0.43..0.46 rows=1 width=22)\n Output: current_keyword.store_id, current_keyword.e, current_keyword.a, current_keyword.v\n Index Cond: ((current_keyword.store_id = '0'::bigint) AND (current_keyword.e = current_ref.e) AND (current_keyword.a = 1000004))\n -> Index Only Scan using current_text_pkey on mentat.current_text current_text_1 (cost=0.43..0.46 rows=1 width=32)\n Output: current_text_1.store_id, current_text_1.e, current_text_1.a, current_text_1.v\n Index Cond: ((current_text_1.store_id = '0'::bigint) AND (current_text_1.e = current_ref.e) AND (current_text_1.a = 1000003))\nQuery Identifier: -4490474045478190106", "datalog_query": "[:find ?i ?title ?state :in $ ?email :where [?u :user/email ?email] [?i :issue/assignee ?u] [?i :issue/title ?title] [?i :issue/state ?state]]", "generated_sql": "SELECT DISTINCT datoms1.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 datoms3.value_type_tag WHEN 0 THEN datoms3.v_ref::TEXT WHEN 1 THEN datoms3.v_bool::TEXT WHEN 2 THEN datoms3.v_long::TEXT WHEN 3 THEN 'd:' || ('x' || encode(float8send(datoms3.v_double), 'hex'))::bit(64)::bigint::TEXT WHEN 4 THEN to_char(datoms3.v_instant AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') WHEN 7 THEN datoms3.v_text WHEN 8 THEN ':' || datoms3.v_keyword WHEN 10 THEN datoms3.v_uuid::TEXT WHEN 11 THEN encode(datoms3.v_bytes, 'hex') ELSE NULL::TEXT END FROM (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 = 1000001) AS datoms0, (SELECT e, a, 0::SMALLINT AS value_type_tag, v AS v_ref, NULL::BOOLEAN AS v_bool, NULL::BIGINT 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_ref WHERE store_id = $1 AND a = 1000006) 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, (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 datoms3 WHERE datoms0.a = (SELECT entid FROM mentat.schema WHERE ident = $2) AND datoms0.added = true AND datoms1.a = (SELECT entid FROM mentat.schema WHERE ident = $3) AND datoms1.v_ref = datoms0.e AND datoms1.added = true AND datoms2.e = datoms1.e AND datoms2.a = (SELECT entid FROM mentat.schema WHERE ident = $4) AND datoms2.added = true AND datoms3.e = datoms1.e AND datoms3.a = (SELECT entid FROM mentat.schema WHERE ident = $5) AND datoms3.added = true AND (datoms0.v_text = $6 AND datoms0.value_type_tag = 7)"}