1. (3.55ms; exec 3.53 + fetch 0.02; rows 1) SELECT b.object_id, b.term, b.bill_number, b.print_number, b.title, b.source_status, COALESCE(r.snapshot, JSON_OBJECT())…
2. (10.2ms; exec 9.56 + fetch 0.64; rows 67) SELECT DISTINCT p.object_id, p.term, p.print_number, p.title, p.eli_id, a.object_id AS legal_act_id, l.evidence_id, pr.s…
3. (57.94ms; exec 57.48 + fetch 0.46; rows 67) SELECT e.id, e.fetch_id, e.selector_type, e.selector, e.quote_text, f.requested_url, f.finished_at, s.code AS source_cod…
4. (5.17ms; exec 4.95 + fetch 0.22; rows 13) SELECT s.stage_path, s.parent_path, s.stage_type, s.stage_name, s.source_date, s.evidence_id, p.term, r.snapshot AS proc…
5. (2.84ms; exec 2.82 + fetch 0.02; rows 0) SELECT d.object_id, d.source_date, d.statement_count, (SELECT MIN(re.evidence_id) FROM revision_evidence re WHERE re.rev…
6. (1.14ms; exec 1.11 + fetch 0.02; rows 1) SELECT r.id, r.snapshot FROM sejm_processes p JOIN object_revisions r ON r.id = p.current_revision_id WHERE p.object_id …
7. (1.76ms; exec 1.69 + fetch 0.07; rows 13) SELECT s.stage_path, s.stage_name, s.source_date, s.evidence_id, f.requested_url AS source_url FROM sejm_process_stages …
8. (3.71ms; exec 3.67 + fetch 0.05; rows 1) SELECT v.object_id, v.current_revision_id AS revision_id, v.reconciliation_state, r.snapshot FROM sejm_votes v JOIN obje…
9. (2.49ms; exec 2.46 + fetch 0.02; rows 1) SELECT re.evidence_id, f.requested_url FROM revision_evidence re JOIN evidence e ON e.id = re.evidence_id JOIN fetches f…
10. (3.57ms; exec 3.42 + fetch 0.15; rows 6) SELECT t.source_field, t.announced_count, t.individual_count, t.evidence_id FROM sejm_vote_totals t JOIN evidence e ON e…
11. (13.38ms; exec 12.25 + fetch 1.13; rows 460) SELECT v.mp_number, v.mp_entity_id, v.raw_choice, v.raw_club, v.first_name, v.last_name, v.evidence_id FROM sejm_individ…
12. (1.21ms; exec 1.18 + fetch 0.03; rows 1) SELECT JSON_VALUE(r.snapshot, '$.dateOfReceipt') AS received_on, JSON_VALUE(r.snapshot, '$.applicantType') AS applicant_…
13. (0.9ms; exec 0.88 + fetch 0.02; rows 1) SELECT b.term, r.id, r.snapshot FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id WHERE b.object…
14. (3.28ms; exec 3.26 + fetch 0.02; rows 1) SELECT DISTINCT l.process_id FROM sejm_bill_process_links l JOIN sejm_processes p ON p.object_id = l.process_id AND p.te…
15. (0.56ms; exec 0.55 + fetch 0.01; rows 1) SELECT r.snapshot FROM sejm_processes p JOIN object_revisions r ON r.id = p.current_revision_id WHERE p.object_id = 4407
16. (1.21ms; exec 1.19 + fetch 0.02; rows 0) SELECT s.committee_code, s.sitting_number, r.id AS revision_id, r.snapshot FROM sejm_committee_sittings s JOIN object_re…
17. (0.98ms; exec 0.96 + fetch 0.02; rows 1) SELECT b.term, r.id AS revision_id FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id WHERE b.obj…
18. (2.83ms; exec 1.71 + fetch 1.11; rows 67) SELECT p.object_id AS process_id, p.term, p.print_number, r.id AS revision_id, r.snapshot FROM sejm_bill_process_links l…
19. (6.57ms; exec 6.55 + fetch 0.02; rows 1) SELECT re.evidence_id FROM revision_evidence re JOIN evidence e ON e.id = re.evidence_id JOIN fetches f ON f.id = e.fetc…
20. (2.35ms; exec 2.31 + fetch 0.03; rows 1) SELECT stage_path, evidence_id FROM sejm_process_stages JOIN evidence stage_evidence ON stage_evidence.id = evidence_id …
21. (1.17ms; exec 1.16 + fetch 0.01; rows 0) SELECT object_id, current_revision_id FROM sejm_prints WHERE term = 10 AND print_number = '1418'
22. (1.01ms; exec 1 + fetch 0.02; rows 1) SELECT term, bill_number FROM sejm_bills WHERE object_id = 596
23. (4.4ms; exec 4.38 + fetch 0.02; rows 0) SELECT r.external_key AS cms_id, o.id AS observation_id, o.fetch_id, o.payload, f.requested_url AS senate_url, LOWER(HEX…
24. (0.91ms; exec 0.89 + fetch 0.02; rows 1) SELECT b.term, r.id AS revision_id, JSON_VALUE(r.snapshot, '$.print') AS print_number FROM sejm_bills b JOIN object_revi…
25. (2.84ms; exec 2.82 + fetch 0.02; rows 0) SELECT p.source_id, p.article_id, p.action_kind, p.review_mode, o.id AS observation_id, o.payload, projected.evidence_id…
26. (1.06ms; exec 1.04 + fetch 0.02; rows 1) SELECT b.term, r.id AS revision_id, r.snapshot FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id…
27. (5.13ms; exec 5.1 + fetch 0.04; rows 1) SELECT p.object_id AS process_id, p.term, p.print_number, MIN(link.evidence_id) AS evidence_id FROM sejm_bill_process_li…
28. (0.69ms; exec 0.67 + fetch 0.02; rows 1) SELECT r.id, r.snapshot FROM sejm_processes p JOIN object_revisions r ON r.id = p.current_revision_id WHERE p.object_id …
29. (0.81ms; exec 0.8 + fetch 0.01; rows 0) SELECT DISTINCT CAST(r.scope AS CHAR) AS scope FROM source_records r JOIN sources source ON source.id = r.source_id AND …
30. (2.7ms; exec 2.69 + fetch 0.01; rows 0) WITH RECURSIVE related_prints (print_id, revision_id, print_number, relation_evidence_id) AS ( SELECT p.object_id, CASE …
31. (11.05ms; exec 11.03 + fetch 0.02; rows 0) WITH RECURSIVE root_prints (print_id) AS ( SELECT DISTINCT p.object_id FROM sejm_bills b JOIN object_revisions bill_revi…
32. (6.41ms; exec 6.35 + fetch 0.05; rows 2) SELECT r.id AS revision_id, r.object_id, r.revision_no, r.snapshot, MIN(o.observed_at) AS observed_at, CASE WHEN b.objec…
33. (7.75ms; exec 7.55 + fetch 0.2; rows 75) SELECT re.revision_id, re.evidence_id FROM revision_evidence re JOIN evidence e ON e.id = re.evidence_id JOIN fetches f …
34. (5.68ms; exec 5.66 + fetch 0.03; rows 0) SELECT assignment.id AS assignment_id, assignment.object_id, topic.id AS topic_id, topic.slug, topic.name, assignment.ma…
toggle
1. (3.55ms; exec 3.53 + fetch 0.02; rows 1) SELECT b.object_id, b.term, b.bill_number, b.print_number, b.title, b.source_status, COALESCE(r.snapshot, JSON_OBJECT()) AS snapshot FROM sejm_bills b LEFT JOIN object_revisions r ON r.id = ( SELECT r2.id FROM object_revisions r2 WHERE r2.object_id = b.object_id AND (NULL IS NULL OR r2.recorded_at <= NULL) ORDER BY r2.revision_no DESC LIMIT 1 ) WHERE b.object_id = 596 AND (NULL IS NULL OR r.id IS NOT NULL)
2. (10.2ms; exec 9.56 + fetch 0.64; rows 67) SELECT DISTINCT p.object_id, p.term, p.print_number, p.title, p.eli_id, a.object_id AS legal_act_id, l.evidence_id, pr.snapshot, (SELECT MIN(re.evidence_id) FROM revision_evidence re WHERE re.revision_id = pr.id AND re.field_path = '$') AS process_evidence_id, publication.published_date AS publication_date, (SELECT MIN(e.id) FROM eli_act_source_facts fact JOIN eli_act_fact_evidence fe ON fe.fact_id = fact.id JOIN evidence e ON e.id = fe.evidence_id WHERE fact.act_id = a.object_id AND fact.field_code = 'promulgation' AND fact.source_date = publication.published_date AND JSON_VALUE(e.selector, '$.pointer') = '/promulgation') AS publication_evidence_id FROM sejm_bill_process_links l JOIN sejm_bills b ON b.object_id = l.bill_id AND b.current_revision_id = l.bill_revision_id JOIN sejm_processes p ON p.object_id = l.process_id JOIN object_revisions pr ON pr.id = p.current_revision_id LEFT JOIN legal_acts a ON a.object_id = p.legal_act_id AND a.eli_id = p.eli_id LEFT JOIN publications publication ON publication.act_id = a.object_id AND a.publisher_code = 'DU' AND publication.publisher_code = 'DU' WHERE l.bill_id = 596
3. (57.94ms; exec 57.48 + fetch 0.46; rows 67) SELECT e.id, e.fetch_id, e.selector_type, e.selector, e.quote_text, f.requested_url, f.finished_at, s.code AS source_code, LOWER(HEX(a.sha256)) AS artifact_sha256, a.detected_mime, a.byte_size FROM evidence e JOIN fetches f ON f.id = e.fetch_id JOIN source_endpoints ep ON ep.id = f.endpoint_id JOIN sources s ON s.id = ep.source_id JOIN artifacts a ON a.id = e.artifact_id WHERE e.id IN (121944,175901,178426,207172,209710,242295,244833,277406,279944,316511,319049,323283,325821,353876,356414,390205,392743,429376,431914,470005,472543,498633,501171,505157,507695,512254,514792,517899,520437,523486,526024,530591,533129,536230,538768,543202,545740,548860,551398,556135,558673,561765,564303,567380,569918,573640,576178,579268,581806,586550,589088,592054,594592,597747,600285,603918,606456,609325,611863,615364,617902,620828,623366,627107,629645,632764,635306)
4. (5.17ms; exec 4.95 + fetch 0.22; rows 13) SELECT s.stage_path, s.parent_path, s.stage_type, s.stage_name, s.source_date, s.evidence_id, p.term, r.snapshot AS process_snapshot FROM sejm_process_stages s JOIN sejm_processes p ON p.object_id = s.process_id JOIN object_revisions r ON r.id = s.process_revision_id WHERE s.process_revision_id = COALESCE( (SELECT r.id FROM object_revisions r WHERE r.object_id = 4407 AND NULL IS NOT NULL AND r.recorded_at <= NULL ORDER BY r.revision_no DESC LIMIT 1), (SELECT IF(NULL IS NULL, p.current_revision_id, NULL) FROM sejm_processes p WHERE p.object_id = 4407)) ORDER BY s.parent_path IS NOT NULL, s.ordinal
5. (2.84ms; exec 2.82 + fetch 0.02; rows 0) SELECT d.object_id, d.source_date, d.statement_count, (SELECT MIN(re.evidence_id) FROM revision_evidence re WHERE re.revision_id = d.current_revision_id AND re.field_path = '$') AS evidence_id FROM sejm_transcript_days d WHERE d.term = 10 AND d.proceeding_number = 39 AND d.current_revision_id IS NOT NULL ORDER BY d.source_date
6. (1.14ms; exec 1.11 + fetch 0.02; rows 1) SELECT r.id, r.snapshot FROM sejm_processes p JOIN object_revisions r ON r.id = p.current_revision_id WHERE p.object_id = 4407
7. (1.76ms; exec 1.69 + fetch 0.07; rows 13) SELECT s.stage_path, s.stage_name, s.source_date, s.evidence_id, f.requested_url AS source_url FROM sejm_process_stages s JOIN evidence e ON e.id = s.evidence_id JOIN fetches f ON f.id = e.fetch_id WHERE s.process_revision_id = 3947
8. (3.71ms; exec 3.67 + fetch 0.05; rows 1) SELECT v.object_id, v.current_revision_id AS revision_id, v.reconciliation_state, r.snapshot FROM sejm_votes v JOIN object_revisions r ON r.id = v.current_revision_id WHERE v.term = 10 AND v.sitting_number = 39 AND v.voting_number = 40
9. (2.49ms; exec 2.46 + fetch 0.02; rows 1) SELECT re.evidence_id, f.requested_url FROM revision_evidence re JOIN evidence e ON e.id = re.evidence_id JOIN fetches f ON f.id = e.fetch_id WHERE re.revision_id = 6199 AND (NULL IS NULL OR f.finished_at <= NULL) ORDER BY re.evidence_id LIMIT 1
10. (3.57ms; exec 3.42 + fetch 0.15; rows 6) SELECT t.source_field, t.announced_count, t.individual_count, t.evidence_id FROM sejm_vote_totals t JOIN evidence e ON e.id = t.evidence_id JOIN fetches f ON f.id = e.fetch_id WHERE t.vote_revision_id = 6199 AND (NULL IS NULL OR f.finished_at <= NULL)
11. (13.38ms; exec 12.25 + fetch 1.13; rows 460) SELECT v.mp_number, v.mp_entity_id, v.raw_choice, v.raw_club, v.first_name, v.last_name, v.evidence_id FROM sejm_individual_votes v JOIN evidence e ON e.id = v.evidence_id JOIN fetches f ON f.id = e.fetch_id WHERE v.vote_revision_id = 6199 AND (NULL IS NULL OR f.finished_at <= NULL) ORDER BY v.raw_club, v.last_name, v.first_name, v.mp_number
12. (1.21ms; exec 1.18 + fetch 0.03; rows 1) SELECT JSON_VALUE(r.snapshot, '$.dateOfReceipt') AS received_on, JSON_VALUE(r.snapshot, '$.applicantType') AS applicant_type, JSON_VALUE(r.snapshot, '$.submissionType') AS submission_type, JSON_VALUE(r.snapshot, '$.description') AS description, JSON_VALUE(r.snapshot, '$.print') AS print_number FROM object_revisions r WHERE r.object_id = 596 AND (NULL IS NULL OR r.recorded_at <= NULL) ORDER BY r.revision_no DESC LIMIT 1
13. (0.9ms; exec 0.88 + fetch 0.02; rows 1) SELECT b.term, r.id, r.snapshot FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id WHERE b.object_id = 596
14. (3.28ms; exec 3.26 + fetch 0.02; rows 1) SELECT DISTINCT l.process_id FROM sejm_bill_process_links l JOIN sejm_processes p ON p.object_id = l.process_id AND p.term = 10 JOIN evidence e ON e.id = l.evidence_id JOIN fetches f ON f.id = e.fetch_id WHERE l.bill_id = 596 AND l.bill_revision_id = 596 AND (NULL IS NULL OR f.finished_at <= NULL)
15. (0.56ms; exec 0.55 + fetch 0.01; rows 1) SELECT r.snapshot FROM sejm_processes p JOIN object_revisions r ON r.id = p.current_revision_id WHERE p.object_id = 4407
16. (1.21ms; exec 1.19 + fetch 0.02; rows 0) SELECT s.committee_code, s.sitting_number, r.id AS revision_id, r.snapshot FROM sejm_committee_sittings s JOIN object_revisions r ON r.id = s.current_revision_id WHERE s.term = 10
17. (0.98ms; exec 0.96 + fetch 0.02; rows 1) SELECT b.term, r.id AS revision_id FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id WHERE b.object_id = 596
18. (2.83ms; exec 1.71 + fetch 1.11; rows 67) SELECT p.object_id AS process_id, p.term, p.print_number, r.id AS revision_id, r.snapshot FROM sejm_bill_process_links l JOIN sejm_processes p ON p.object_id = l.process_id AND p.term = 10 JOIN object_revisions r ON r.id = p.current_revision_id WHERE l.bill_id = 596 AND l.bill_revision_id = 596
19. (6.57ms; exec 6.55 + fetch 0.02; rows 1) SELECT re.evidence_id FROM revision_evidence re JOIN evidence e ON e.id = re.evidence_id JOIN fetches f ON f.id = e.fetch_id JOIN source_endpoints endpoint ON endpoint.id = f.endpoint_id JOIN sources source ON source.id = endpoint.source_id AND source.code = 'sejm-processes' WHERE re.revision_id = 3947 AND re.field_path = '$' AND f.requested_url = 'https://api.sejm.gov.pl/sejm/term10/processes/1303' AND f.http_status = 200 AND f.outcome = 'success' AND (NULL IS NULL OR f.finished_at <= NULL) ORDER BY f.finished_at DESC, re.evidence_id DESC LIMIT 1
20. (2.35ms; exec 2.31 + fetch 0.03; rows 1) SELECT stage_path, evidence_id FROM sejm_process_stages JOIN evidence stage_evidence ON stage_evidence.id = evidence_id JOIN evidence process_evidence ON process_evidence.id = 121930 AND process_evidence.fetch_id = stage_evidence.fetch_id WHERE process_revision_id = 3947 AND stage_type = 'CommitteeReport' ORDER BY stage_path
21. (1.17ms; exec 1.16 + fetch 0.01; rows 0) SELECT object_id, current_revision_id FROM sejm_prints WHERE term = 10 AND print_number = '1418'
22. (1.01ms; exec 1 + fetch 0.02; rows 1) SELECT term, bill_number FROM sejm_bills WHERE object_id = 596
23. (4.4ms; exec 4.38 + fetch 0.02; rows 0) SELECT r.external_key AS cms_id, o.id AS observation_id, o.fetch_id, o.payload, f.requested_url AS senate_url, LOWER(HEX(a.sha256)) AS artifact_sha256 FROM source_records r JOIN sources s ON s.id = r.source_id JOIN source_record_observations o ON o.record_id = r.id JOIN fetches f ON f.id = o.fetch_id JOIN processing_inputs input ON input.run_id = o.processing_run_id AND input.role = 'source_response' AND input.ordinal = 1 JOIN artifacts a ON a.id = input.artifact_id WHERE s.code = 'senat-legislative-initiatives' AND r.record_type = 'senat-initiative' AND o.id = ( SELECT latest.id FROM source_record_observations latest JOIN fetches latest_fetch ON latest_fetch.id = latest.fetch_id WHERE latest.record_id = r.id AND latest.locator = CONCAT('detail:', CAST(r.external_key AS CHAR)) AND (NULL IS NULL OR latest_fetch.finished_at <= NULL) ORDER BY latest_fetch.finished_at DESC, latest.fetch_id DESC, latest.id DESC LIMIT 1 ) ORDER BY r.id
24. (0.91ms; exec 0.89 + fetch 0.02; rows 1) SELECT b.term, r.id AS revision_id, JSON_VALUE(r.snapshot, '$.print') AS print_number FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id WHERE b.object_id = 596
25. (2.84ms; exec 2.82 + fetch 0.02; rows 0) SELECT p.source_id, p.article_id, p.action_kind, p.review_mode, o.id AS observation_id, o.payload, projected.evidence_id FROM president_events p JOIN sources s ON s.id = p.source_id AND s.code = 'president-legislation' JOIN president_event_observations projected ON projected.observation_id = ( SELECT latest.id FROM president_event_observations next_projection JOIN source_record_observations latest ON latest.id = next_projection.observation_id JOIN fetches f ON f.id = latest.fetch_id WHERE next_projection.event_id = p.object_id AND (NULL IS NULL OR (latest.observed_at <= NULL AND f.finished_at <= NULL)) ORDER BY f.finished_at DESC, latest.id DESC LIMIT 1) JOIN source_record_observations o ON o.id = projected.observation_id WHERE p.print_number = '1303' ORDER BY p.object_id
26. (1.06ms; exec 1.04 + fetch 0.02; rows 1) SELECT b.term, r.id AS revision_id, r.snapshot FROM sejm_bills b JOIN object_revisions r ON r.id = b.current_revision_id WHERE b.object_id = 596
27. (5.13ms; exec 5.1 + fetch 0.04; rows 1) SELECT p.object_id AS process_id, p.term, p.print_number, MIN(link.evidence_id) AS evidence_id FROM sejm_bill_process_links link JOIN sejm_processes p ON p.object_id = link.process_id AND p.term = 10 AND p.print_number = '1303' JOIN evidence e ON e.id = link.evidence_id AND e.selector_type = 'json_pointer' JOIN fetches f ON f.id = e.fetch_id AND f.http_status = 200 AND f.outcome = 'success' JOIN source_endpoints endpoint ON endpoint.id = f.endpoint_id JOIN sources source ON source.id = endpoint.source_id WHERE link.bill_id = 596 AND link.bill_revision_id = 596 AND ((source.code = 'sejm-bills' AND JSON_VALUE(e.selector, '$.pointer') LIKE '%/print') OR (source.code = 'sejm-processes' AND JSON_VALUE(e.selector, '$.pointer') = '/number')) AND (NULL IS NULL OR f.finished_at <= NULL) GROUP BY p.object_id, p.term, p.print_number ORDER BY p.object_id
28. (0.69ms; exec 0.67 + fetch 0.02; rows 1) SELECT r.id, r.snapshot FROM sejm_processes p JOIN object_revisions r ON r.id = p.current_revision_id WHERE p.object_id = 4407
29. (0.81ms; exec 0.8 + fetch 0.01; rows 0) SELECT DISTINCT CAST(r.scope AS CHAR) AS scope FROM source_records r JOIN sources source ON source.id = r.source_id AND source.code = 'tk-ipo-otk' WHERE r.record_type = 'tk-ipo-petition-target' AND r.scope LIKE 'case:%'
30. (2.7ms; exec 2.69 + fetch 0.01; rows 0) WITH RECURSIVE related_prints (print_id, revision_id, print_number, relation_evidence_id) AS ( SELECT p.object_id, CASE WHEN NULL IS NULL THEN p.current_revision_id ELSE (SELECT o.revision_id FROM sejm_observations o JOIN fetches f ON f.id = o.fetch_id JOIN object_revisions r ON r.id = o.revision_id WHERE o.object_id = p.object_id AND o.observed_at <= NULL AND f.finished_at <= NULL AND r.recorded_at <= NULL ORDER BY (o.source_pointer = '') DESC, f.finished_at DESC, o.fetch_id DESC, r.revision_no DESC LIMIT 1) END, p.print_number, CAST(NULL AS UNSIGNED) FROM sejm_prints p WHERE p.term = 10 AND p.print_number = '1303' UNION DISTINCT SELECT child.object_id, observation.revision_id, child.print_number, a.evidence_id FROM related_prints parent JOIN sejm_additional_prints a ON a.parent_print_id = parent.print_id AND a.parent_revision_id = parent.revision_id JOIN sejm_prints child ON child.object_id = a.child_print_id JOIN evidence relation ON relation.id = a.evidence_id JOIN sejm_observations observation ON observation.object_id = child.object_id AND observation.fetch_id = relation.fetch_id AND observation.artifact_id = relation.artifact_id AND observation.source_pointer = JSON_VALUE(relation.selector, '$.pointer') ) SELECT d.object_id AS id, d.title, p.print_number, MIN(p.relation_evidence_id) AS relation_evidence_id FROM related_prints p JOIN documents d ON d.owner_object_id = p.print_id WHERE p.revision_id IS NOT NULL AND EXISTS (SELECT 1 FROM document_versions v WHERE v.document_id = d.object_id AND (NULL IS NULL OR v.first_observed_at <= NULL)) GROUP BY d.object_id, d.title, p.print_number ORDER BY d.object_id
31. (11.05ms; exec 11.03 + fetch 0.02; rows 0) WITH RECURSIVE root_prints (print_id) AS ( SELECT DISTINCT p.object_id FROM sejm_bills b JOIN object_revisions bill_revision ON bill_revision.object_id = b.object_id JOIN sejm_prints p ON p.term = b.term AND p.print_number = JSON_VALUE(bill_revision.snapshot, '$.print') WHERE b.object_id = 596 AND EXISTS (SELECT 1 FROM sejm_observations bill_observation WHERE bill_observation.object_id = b.object_id AND bill_observation.revision_id = bill_revision.id) ), related_prints (print_id) AS ( SELECT print_id FROM root_prints UNION DISTINCT SELECT additional.child_print_id FROM related_prints parent JOIN sejm_additional_prints additional ON additional.parent_print_id = parent.print_id JOIN object_revisions print_revision ON print_revision.id = additional.parent_revision_id JOIN evidence relation_evidence ON relation_evidence.id = additional.evidence_id JOIN fetches relation_fetch ON relation_fetch.id = relation_evidence.fetch_id WHERE 1 = 1 ) SELECT DISTINCT p.object_id AS process_id, d.object_id AS document_id FROM related_prints related JOIN sejm_prints print ON print.object_id = related.print_id LEFT JOIN sejm_processes p ON p.term = print.term AND p.print_number = print.print_number LEFT JOIN documents d ON d.owner_object_id = related.print_id AND EXISTS (SELECT 1 FROM document_versions version WHERE version.document_id = d.object_id AND version.version_basis = 'source_key')
32. (6.41ms; exec 6.35 + fetch 0.05; rows 2) SELECT r.id AS revision_id, r.object_id, r.revision_no, r.snapshot, MIN(o.observed_at) AS observed_at, CASE WHEN b.object_id IS NOT NULL THEN 'bill' ELSE 'process' END AS entity_type, b.bill_number, p.print_number FROM object_revisions r JOIN sejm_observations o ON o.revision_id = r.id AND o.object_id = r.object_id JOIN fetches f ON f.id = o.fetch_id LEFT JOIN sejm_bills b ON b.object_id = r.object_id LEFT JOIN sejm_processes p ON p.object_id = r.object_id WHERE r.object_id IN (596,4407) GROUP BY r.id, r.object_id, r.revision_no, r.snapshot, b.object_id, b.bill_number, p.print_number ORDER BY r.object_id, observed_at, r.revision_no
33. (7.75ms; exec 7.55 + fetch 0.2; rows 75) SELECT re.revision_id, re.evidence_id FROM revision_evidence re JOIN evidence e ON e.id = re.evidence_id JOIN fetches f ON f.id = e.fetch_id WHERE re.revision_id IN (596,3947) GROUP BY re.revision_id, re.evidence_id ORDER BY re.revision_id, re.evidence_id
34. (5.68ms; exec 5.66 + fetch 0.03; rows 0) SELECT assignment.id AS assignment_id, assignment.object_id, topic.id AS topic_id, topic.slug, topic.name, assignment.match_basis, assignment.matched_value, assignment.evidence_id, rule.rule_code, rule.version AS rule_version, evidence.quote_text, CASE WHEN bill.object_id IS NULL THEN 'act' ELSE 'case' END AS kind, COALESCE(bill.title, act.title) AS title, COALESCE(bill.bill_number, act.eli_id) AS identifier, CASE WHEN bill.object_id IS NULL THEN CONCAT('/acts/', assignment.object_id) ELSE CONCAT('/cases/', assignment.object_id) END AS url, latest.decision AS latest_decision, actor.display_name AS latest_decision_by, latest.recorded_at AS latest_decision_at, NULL AS my_decision, NULL AS my_decision_at FROM topic_assignments assignment JOIN objects source_object ON source_object.id = assignment.object_id AND source_object.current_revision_id = assignment.revision_id JOIN topics topic ON topic.id = assignment.topic_id JOIN topic_rules rule ON rule.id = assignment.rule_id JOIN evidence ON evidence.id = assignment.evidence_id LEFT JOIN sejm_bills bill ON bill.object_id = assignment.object_id LEFT JOIN legal_acts act ON act.object_id = assignment.object_id LEFT JOIN topic_decisions latest ON latest.id = ( SELECT decision.id FROM topic_decisions decision WHERE decision.assignment_id = assignment.id ORDER BY decision.recorded_at DESC, decision.id DESC LIMIT 1) LEFT JOIN users actor ON actor.id = latest.actor_user_id WHERE assignment.is_current = 1 AND rule.enabled = 1 AND topic.enabled = 1 AND assignment.object_id IN (596) ORDER BY assignment.object_id, topic.name, FIELD(assignment.match_basis, 'eli_keyword', 'fulltext_phrase', 'title_term'), assignment.id