Skip to content
New issue

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

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

Already on GitHub? # to your account

[FEATURE]: Cancel empty queries #2765

Closed
jakeleventhal opened this issue Aug 8, 2024 · 1 comment
Closed

[FEATURE]: Cancel empty queries #2765

jakeleventhal opened this issue Aug 8, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@jakeleventhal
Copy link

jakeleventhal commented Aug 8, 2024

Describe what you want

Some drizzle statements, like inArray(someTable.id, []), will evaluate to the following SQL:

DELETE FROM sometable WHERE false

It is possible to have complex layering of query conditions, but this feature is to propose canceling queries entirely and just resolving the promise for calls that will result in no data, updates, etc.

The goal would be to recursively check all conditions in a WHERE clause and determine if the entire result can be simplified to false. If so, never make an attempt to reach the db. This would just speed up some API calls and remove the need to contact the DB in many cases

@L-Mario564
Copy link
Collaborator

Checking for these kind of conditions adds overhead to the ORM and even if no rows are affected, some developers may still want to execute them because of triggers or for logging purposes. This won't be worked on as the developer should be responsible for running or not running said queries.

@L-Mario564 L-Mario564 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants