Skip to content

Conversation

@orthagh
Copy link
Contributor

@orthagh orthagh commented Nov 19, 2025

Description

  • SELECT COUNT without JOIN doesn't need to be DISTINCT
  • GROUP BY id instead name/completename on "multiple" graphs make a significative gain
  • add a composite index (is_deleted, is_template) to filter out unactive item (this has a significative gain on softwares)

    This has been extended to all other itemtype with this key combination
    regex:

    /CREATE TABLE `([a-zA-Z_]+s)`\X[^;]*`is_deleted`\X[^;]*`is_template`/gmUs
    
  • tempory cache for Filter::getAppliableFilters where most of the hit was

@orthagh orthagh added this to the 11.0.3 milestone Nov 19, 2025
@orthagh orthagh changed the title a few sql optimization for dashboards a few sql optimizations for dashboards Nov 19, 2025
Copy link
Contributor

@trasher trasher left a comment

Choose a reason for hiding this comment

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

You will have to remove the is_template and is_deleted keys to fix tests.

I do not know if you plan other improvements, but those ones shoudl target next release I guess.

@orthagh
Copy link
Contributor Author

orthagh commented Nov 24, 2025

You will have to remove the is_template and is_deleted keys to fix tests.

Probably only is_deleted as it's the first is the construction of the composite key, is_template is still required/

@orthagh
Copy link
Contributor Author

orthagh commented Nov 24, 2025

TODO: cache management for filters isn't clearable at the moment, and I need to find another way to store/delete.
This is a priority because it takes 100ms on each card/widget to check if there are appliable filters even when no filters exist. As we use AJAX to display cards, it delays every other card, and this cumulates very fast.
On my local instance, neutralizing this piece of code is a raw 1.5s~ gain. I suppose this could have greater impact on cloud/online instances.

Edit: done by a short ttl

@orthagh orthagh changed the title a few sql optimizations for dashboards a few optimizations for dashboards Nov 24, 2025
@orthagh orthagh marked this pull request as ready for review November 25, 2025 10:02
Co-authored-by: Johan Cwiklinski <[email protected]>
Copy link
Contributor

@AdrienClairembault AdrienClairembault left a comment

Choose a reason for hiding this comment

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

There are PHPStan errors

@trasher trasher merged commit 88de091 into glpi-project:11.0/bugfixes Nov 26, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants