Skip to content

improve checklist_items performance#9849

Open
usu wants to merge 5 commits into
ecamp:develfrom
usu:fix/checklist-item-performance
Open

improve checklist_items performance#9849
usu wants to merge 5 commits into
ecamp:develfrom
usu:fix/checklist-item-performance

Conversation

@usu
Copy link
Copy Markdown
Member

@usu usu commented May 24, 2026

Fixes #8668

Replaces the query /api/checklist_items?checklistNodes=%2Fapi%2Fcontent_node%2Fchecklist_nodes%2F{id}%2F
by a dedicated subresoure /api/content_node/checklist_nodes/{id}/checklist_items

and disables eager loading for this operation. Given that the number of returned items from this query is rather small (selected checklist items in a specific activity), the additional toll for disabling eager loading is much slower than what is gained by making the initial SQL query fast.

Some more information on what I found out why the original query is slow is documented in #8668.

@usu usu added the deploy! Creates a feature branch deployment for this PR label May 24, 2026
@usu usu temporarily deployed to feature-branch May 24, 2026 08:29 — with GitHub Actions Inactive
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 24, 2026

Feature branch deployment ready!

Name Link
😎 Deployment https://pr9849.ecamp3.ch/
🔑 Login test@example.com / test
🕒 Last deployed at Sat May 30 2026 22:25:42 GMT+0200
🔨 Latest commit 3cdf7ce2e5f66e53649bcda8afc1ddfabe4591f9
🔍 Latest deploy log https://github.com/ecamp/ecamp3/actions/runs/26694018531/job/78675354747
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

@usu usu force-pushed the fix/checklist-item-performance branch from ee3480c to 1abc182 Compare May 24, 2026 08:43
@usu usu temporarily deployed to feature-branch May 24, 2026 08:44 — with GitHub Actions Inactive
@BacLuc
Copy link
Copy Markdown
Contributor

BacLuc commented May 24, 2026

I had AI try a slightly different approach. I couldn't test and review it yet.
But maybe you find something useful:
https://github.com/BacLuc/ecamp3/tree/improve-checklist-performance

@usu usu temporarily deployed to feature-branch May 25, 2026 04:52 — with GitHub Actions Inactive
@usu usu temporarily deployed to feature-branch May 25, 2026 05:16 — with GitHub Actions Inactive
@usu usu marked this pull request as ready for review May 25, 2026 05:22
@usu usu requested a review from a team May 25, 2026 05:22
@usu usu removed the deploy! Creates a feature branch deployment for this PR label May 25, 2026
@BacLuc
Copy link
Copy Markdown
Contributor

BacLuc commented May 25, 2026

hm, it seems we broke the feature branch deployment with postgres 18..., sorry for that.

SQLSTATE[42501]: Insufficient privilege: 7 ERROR:  permission denied to create extension pgcrypto

@BacLuc
Copy link
Copy Markdown
Contributor

BacLuc commented May 25, 2026

@BacLuc BacLuc added the deploy! Creates a feature branch deployment for this PR label May 30, 2026
@BacLuc BacLuc deployed to feature-branch May 30, 2026 20:24 — with GitHub Actions Active
@BacLuc
Copy link
Copy Markdown
Contributor

BacLuc commented May 31, 2026

try {
$iri = $this->iriConverter->getIriFromResource($entity, UrlGeneratorInterface::ABS_PATH, $operation);
} catch (NoSuchPropertyException $e) { // @phpstan-ignore catch.neverThrown
// NoSuchPropertyException is thrown for cases where uri parameters cannot determined automatically
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For later:
would be nicer if we could check that case earlier instead of using exceptions for the control flow.

try {
$oldIri = $this->iriConverter->getIriFromResource($oldEntity, UrlGeneratorInterface::ABS_PATH, $operation);
} catch (NoSuchPropertyException $e) { // @phpstan-ignore catch.neverThrown
// NoSuchPropertyException is thrown for cases where uri parameters cannot determined automatically
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For later:
would be nicer if we could check that case earlier instead of using exceptions for the control flow.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as we don't have the custom logic, maybe a test that this endpoint must currently not be cached, because we don't have a purge logic?

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

Labels

deploy! Creates a feature branch deployment for this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slow query for checklistitems

2 participants