Aidbox / Issues

Issue tracker for Aidbox FHIR backend by Health Samurai
7 stars 0 forks source link

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

Open MFAshby opened 1 year ago

MFAshby commented 1 year ago

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:

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:

Additional context