-
Notifications
You must be signed in to change notification settings - Fork 197
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
Delete all method for entities with @EmbeddedId does not use IN for better performance #373
Comments
the issue is you can't do an IN across 2 columns (as the case with embedded ID) unless I am missing something. Related post with possible solutions https://stackoverflow.com/questions/1136380/sql-where-in-clause-multiple-columns |
I'm pretty sure you can. At least ANSI SQL Syntax contains corresponding syntax to express this. I think it is not supported by 100% of all databases but the most common ones seem to have support. http://sqlfiddle.com/#!9/e69090 select * FROM books
where (id, name) IN (
('1','Test1'),
('4','Test4')
) |
Will see what can be done |
Any plans to implement that? Currently the only way to achieve fast delete is to use native queries manually. |
I'm planning to improve expandable queries for the next release, I might be able to improve this as well |
Any Updates? |
Steps to Reproduce
deleteAll(Collection<Entity>)
on the Repository to delete some selected EntitiesExpected Behaviour
Micronaut data generates and executes one single SQL query using the IN clause in case the selected Dialect supports IN clauses with multiple columns (most do).
Actual Behaviour
Micronaut data interates the provided entities and executes one DELETE statement per entity, this rapidly cuts down performance for large collections of entities.
Environment Information
Example Application
The
master
branch demonstrates the issue (execute the application -> logging will show two executed delete statements).The
simple-id
branch demonstrates the behaviour with simple (non-embedded) ideas which i would also expect from the version with the EmbeddedIdThe text was updated successfully, but these errors were encountered: