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

Change the default DataNucleus flush mode to QUERY #4169

Closed
wants to merge 1 commit into from

Conversation

nscuro
Copy link
Member

@nscuro nscuro commented Sep 24, 2024

Description

The default flush mode is AUTO, which flushes changes to the datastore whenever they are made (i.e. when setters are called on a persistent object).

This behavior can lead to increased database load, in particular when setters are called without prior check if the value being set is indeed different from the object's current value.

Switching to flush mode QUERY will cause DataNucleus to only flush changes upon explicit .flush() or .commit() calls, or just before another query is executed. This should significantly reduce the database calls performed by the ORM.

Addressed Issue

Relates to #4036

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have added corresponding update logic
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

The default flush mode is `AUTO`, which flushes changes to the datastore whenever they are made (i.e. when setters are called on a persistent object).

This behavior can lead to increased database load, in particular when setters are called without prior check if the value being set is indeed different from the object's current value.

Switching to flush mode `QUERY` will cause DataNucleus to only flush changes upon explicit `.flush()` or `.commit()` calls, *or* just before another query is executed. This should significantly reduce the database calls performed by the ORM.

Relates to DependencyTrack#4036

Signed-off-by: nscuro <[email protected]>
@nscuro nscuro closed this Sep 26, 2024
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.

1 participant