Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MFAshby opened this issue Sep 13, 2022 · 0 comments
Open

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

MFAshby opened this issue Sep 13, 2022 · 0 comments
Labels

Comments

@MFAshby
Copy link

MFAshby commented Sep 13, 2022

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

@MFAshby MFAshby added the bug label Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant