2015-10-14 12:07 GMT+02:00 Ross Goldberg <[email protected]>: > Also, introspection on immutable queries would allow for reuse of superset > result sets for subset queries, e.g., if the result set for "where x = 1" > is in the cache, and if "where x = 1 and y = 2" is queried, then the cache > could just iterate over the already cached values "where x = 1", checking > the results for "y = 2", without querying the database. >
Yes, that's a very interesting use-case, although, I'm not so sure if it's a good idea. This will only work if there's not GROUP BY, DISTINCT, aggregation, window functions, etc. Otherwise, you'll start implementing a database to prevent accessing... the database. What is your real-world caching use-case? I tend to say that modern databases are extremely efficient when it comes to using buffer caches for frequently accessed data... Again, this can be done already, using the techniques I've mentioned in my previous response. > It would be useful to have a static helper method like > "Collection<Condition<?>> getSubsetWhereConditions(ImmutableQuery > potentialSupersetQuery, BindContext supersetBindContext, ImmutableQuery > potentialSubsetQuery, BindContext subsetBindContext)" that would return > null if potentialSubsetQuery is not a "subset" query > of potentialSupersetQuery (for the two supplied bind contexts), or, > if potentialSubsetQuery is a "subset" of potentialSupersetQuery, a > Collection<Condition<?>> of the extra Conditions that potentialSubsetQuery > has beyond this (if the where clauses & bind contexts were exactly the > same, then the returned Collection would have size == 0). > Hmm, this API looks very much like a solution to your specific problem, and not very reusable on a global query transformation scale. Perhaps, this is related to your suggestion on the GitHub issue: https://github.com/jOOQ/jOOQ/issues/2198#issuecomment-148040946 But before discussing potential solutions, I'd really first like to understand the use-case(s). I think we might not be talking about the same things (yet). Cheers, Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
