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
Support joins with scala collections using temporary tables #799
Comments
An alternative to this would be fetching all persons and doing the join in-memory. Which one is more efficient depends on which collections is larger, the in-memory one or the (permanent) database table. We will probably need an api for exposing this decision to the user, not only for temporary tables, but also for distributed queries joining tables from multiple dbs. An alternative could be an automatic decision based on profiling or heuristics or something like that. |
I would have needed this again today. |
Me too. Side note: I know of close to zero cases where the in-memory (application input) collection would exceed the respective database table size. By far the most cases of collection comparisons (should) have been located on db side. |
@cvogt, you're of course correct in that efficiency depends on the size of the scala set vs. the table size, however I agree with @KLBonn that the majority of use cases the former will be smaller. In our current project we do quite a bit of micro-batching, which would be helped tremendously if this was a slick feature! |
👍 |
Would have helped me too. Any updates on this? |
👍 |
maybe something @radsaggi can look at later this summer during GSOC |
👍 |
👍 |
I also would love this feature |
Just pointing out that in absence of this feature, people are more likely to store chunks of results inside a Scala variable, which carries a performance penalty, and potentially try to use it in an Which might then involve running into #1739 |
it seems a quite good feature to me. |
damn I've had some great ideas in the past. 10 years ago. |
Couldn't it be done with a VALUES expression? At least in Postgres I'm pretty sure it could.
Sent with Shortwave <https://www.shortwave.com?utm_medium=email&utm_content=signature&utm_source=bmFmdG9saWd1Z0BnbWFpbC5jb20=>
…On Mon Mar 25, 2024, 08:40 PM GMT, Heikki Vesalainen ***@***.***> wrote:
damn I've had some great ideas in the past. 10 years ago.
—
Reply to this email directly, view it on GitHub <#799 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAAYAUHDIGQFZ5X5JSZ6CRDY2CDT5AVCNFSM4APEEPT2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBRHA4DONJTGQ3Q>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Traditionally the way ORMs have supported joins over external data is the use of the SQL
IN
keyword, i.e.This is equivalent to creating a temporary table and doing an inner join on that table.
While it is true, the latter has a more complex SQL syntax, it has the following benefits:
As to the last point, here is something you cannot do with the
IN
keyword.I.e. selecting all the rows from foo where bar = t2.bar and zot = t2.zot.
What I'm requesting is that slick support a nice DSL for doing a join with a scala collection in which the user of the API wouldn't have to handle (or even know about) the createion of the temporary table and the insertion of the values to that table.
E.g. with the current inner join syntax:
would result in
The text was updated successfully, but these errors were encountered: