Skip to content

[BUG] _explain=analyze only returns plan for first SQL query #533

Description

@MFAshby

Describe the bug

_explain=analyze only explains the first SQL query and not any subsequent ones that are part of the same FHIR request.

Severity

Minor

Steps to reproduce the behavior:

  • Have a FHIR store with Patient and Consent resources
  • Make API call
GET /fhir/Patient?identifier=https://fhir.nhs.uk/Id/nhs-number%7C9990577382&_revinclude=Consent:patient&_explain=analyze

Expected behavior

A result showing query and plan for every SQL query made in the request.

Screenshots

Actual query plan is only showing 1 query and missing second query over consent resource

query:
  - >-
    SELECT "patient".* FROM "patient" WHERE "patient".resource @> ? LIMIT ?
    OFFSET ? 
  - >-
    {"identifier":[{"system":"https://fhir.nhs.uk/Id/nhs-number","value":"9990577382"}]}
  - 100
  - 0
plan: >-
  Limit  (cost=2245.80..2696.15 rows=100 width=3613) (actual time=63.759..63.762
  rows=1 loops=1)
    ->  Bitmap Heap Scan on patient  (cost=2245.80..551852.85 rows=122038 width=3613) (actual time=63.757..63.759 rows=1 loops=1)
          Recheck Cond: (resource @> '{"identifier": [{"value": "9990577382", "system": "https://fhir.nhs.uk/Id/nhs-number"}]}'::jsonb)
          Heap Blocks: exact=1
          ->  Bitmap Index Scan on patient_resource_idx  (cost=0.00..2215.29 rows=122038 width=0) (actual time=47.828..47.829 rows=18 loops=1)
                Index Cond: (resource @> '{"identifier": [{"value": "9990577382", "system": "https://fhir.nhs.uk/Id/nhs-number"}]}'::jsonb)
  Planning Time: 0.199 ms

  Execution Time: 64.537 ms

Versions:

  • Aidbox image version:

:latest v:2206.132f8762

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions