{"datalog_plan": {"patterns": [{"idx": 0, "table": "mentat.datoms_keyword_new", "attribute": ":issue/state", "variables": {"value": "?state", "entity": "?i"}}], "complexity": {"cte": false, "joins": 1, "union_all": false, "aggregates": true}, "predicates": [], "not_clauses": 0, "or_branches": 0, "join_variables": [], "ground_bindings": {}, "where_functions": []}, "explain_plan": "Finalize GroupAggregate (cost=26815.80..26817.74 rows=5 width=193)\n Output: (':'::text || current_keyword.v), (count(*))::text, '8'::smallint, NULL::bigint, NULL::boolean, NULL::bigint, NULL::double precision, NULL::text, current_keyword.v, NULL::timestamp with time zone, NULL::uuid, NULL::bytea\n Group Key: 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 = ':issue/state'::text)\n -> Gather Merge (cost=26814.31..26816.09 rows=15 width=22)\n Output: current_keyword.v, (PARTIAL count(*))\n Workers Planned: 3\n Params Evaluated: $0\n -> Sort (cost=25814.27..25814.28 rows=5 width=22)\n Output: current_keyword.v, (PARTIAL count(*))\n Sort Key: current_keyword.v\n -> Partial HashAggregate (cost=25814.16..25814.21 rows=5 width=22)\n Output: current_keyword.v, PARTIAL count(*)\n Group Key: current_keyword.v\n -> Result (cost=0.00..23717.37 rows=419358 width=14)\n Output: current_keyword.v\n One-Time Filter: ($0 = 1000004)\n -> Parallel Seq Scan on mentat.current_keyword (cost=0.00..23717.37 rows=419358 width=14)\n Output: current_keyword.store_id, current_keyword.e, current_keyword.a, current_keyword.v, current_keyword.tx\n Filter: ((current_keyword.store_id = '0'::bigint) AND (current_keyword.a = 1000004))\nQuery Identifier: 5286576539051484251", "datalog_query": "[:find ?state (count ?i) :where [?i :issue/state ?state]]", "generated_sql": "SELECT CASE datoms0.value_type_tag WHEN 0 THEN datoms0.v_ref::TEXT WHEN 1 THEN datoms0.v_bool::TEXT WHEN 2 THEN datoms0.v_long::TEXT WHEN 3 THEN 'd:' || ('x' || encode(float8send(datoms0.v_double), 'hex'))::bit(64)::bigint::TEXT WHEN 4 THEN to_char(datoms0.v_instant AT TIME ZONE 'UTC', 'YYYY-MM-DD\"T\"HH24:MI:SS.US\"Z\"') WHEN 7 THEN datoms0.v_text WHEN 8 THEN ':' || datoms0.v_keyword WHEN 10 THEN datoms0.v_uuid::TEXT WHEN 11 THEN encode(datoms0.v_bytes, 'hex') ELSE NULL::TEXT END, COUNT(*)::TEXT 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 WHERE datoms0.a = (SELECT entid FROM mentat.schema WHERE ident = $2) AND datoms0.added = true GROUP BY datoms0.value_type_tag, datoms0.v_ref, datoms0.v_bool, datoms0.v_long, datoms0.v_double, datoms0.v_text, datoms0.v_keyword, datoms0.v_instant, datoms0.v_uuid, datoms0.v_bytes"}