Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

arthurpar06
Copy link
Member

findWhere retrieves all entries matching the where statement, meaning we were fetching all those entries and then summing them manually, which was not optimized. With this PR, we now sum directly in SQL.

This results in a huge improvement for large journals - FinanceEventHandler execution time dropped from over 13 seconds to less than 1 second on my prod

Changes in app/Repositories/JournalRepository.php:

  • Updated method calls from findWhere to where in recalculateBalance function to improve query consistency.

Should be applied to both v7 and v8

@nabeelio nabeelio merged commit 45ff0e1 into phpvms:main Feb 14, 2025
5 checks passed
@arthurpar06 arthurpar06 deleted the optimizeJournalQuery branch February 14, 2025 15:37
@nabeelio
Copy link
Member

Interesting, nice catch

nabeelio pushed a commit that referenced this pull request Mar 13, 2025
(cherry picked from commit 45ff0e1)
nabeelio added a commit that referenced this pull request May 7, 2025
* Version output fixes (#1954)

* Set the label to be blank

* Fix how the version is parsed when there's no pre-release version specified

* Update the latest metadata

* Correctly output the build metadata

* Update the version file

* Version Tweaks

* Set the mode and incrementals

* Tweaks to version file

* fix: fix hcaptcha sitekey tag (#1979)

* [7.x] Add log viewer (#1972)a

* add opcodesio/log-viewer

* set up with custom permission

---------

Co-authored-by: Nabeel S. <[email protected]>

* Fix pint workflow (#1974)

* [7.x] Add `access_admin` gate (#1975)

* Add access_admin gate

* Add example in seven theme nav

* Add missing ',' in email-plain.blade.php (#1987)

* Update airport IDs/ICAOs to enforce 8-character format (#1988)

* Update airport IDs/ICAOs to 8 chars

* Add nullable (L11 support)

* Update FlightImporter.php (#1983)

* Fix module menu icon

* Update FlightImporter.php

Closes #1982 

Use `0` instead of `null` to follow the `setDays()` function and have a proper match for `firstorNew()`

---------

Co-authored-by: Nabeel S. <[email protected]>

* Register UpdateSimBriefData Listener (#1999)

* Update default activity log retention time (#2000)

* Merge commit from fork

* Optimize JournalRepository (#2007)

* Remove vendor from .htaccess (#1994)

* Move policies

* update guessPolicyNamesUsing

* wip

* Run pint

* Fixes float -> int overflow problem in certain systems.

Fixes float -> int overflow problem in certain systems.

* Add Refresh Token System for OAuth Tokens (#1997)

* Add OAuthTokens refresh logic

* Add tests

* Run pint

* Update IVAO tokens policy

* Update tests

---------

Co-authored-by: Nabeel S. <[email protected]>

* Aircraft's FIN should be unique (#2015)

* Add Pre-Commit Hooks (#1993)

* Add pre commit hooks

* Fix hooks registration

* Fix hooks permissions

* Test pre commit hooks

* Update pint workflow

---------

Co-authored-by: Nabeel S. <[email protected]>

* Update PirepFiled.php (#2036)

Do not load relationships of the `pirep` model while using it for notifications.

* Update Notification (PirepFiled) (#2036)

* Update PirepFiled.php

Do not load relationships of the `pirep` model while using it for notifications.

* Update NotificationEventsHandler.php

Add `->withoutRelations()` call to outgoing mails

---------

Co-authored-by: Nabeel S. <[email protected]>

* Merge branch 'feature/8.0' (#2041)

* Run rector

* Run rector

* update packages

* refactor RolePolicy

---------

Co-authored-by: Nabeel S. <[email protected]>
Co-authored-by: Arthur Hetem <[email protected]>
Co-authored-by: B.Fatih KOZ <[email protected]>
Co-authored-by: Nabeel S. <[email protected]>
Co-authored-by: Taylor Broad <[email protected]>
Co-authored-by: Fikret Anıl Haksever <[email protected]>
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.

2 participants