I have some big ideas for the baked concept which may or may not impact this area as well. But they are only ideas for now, I have many explicit SQLAlchemy tasks that I have to get done before I can try to explore that stuff.
On Wed, Nov 14, 2018 at 4:34 PM Martijn van Oosterhout <klep...@gmail.com> wrote: > > Hoi Mike, > > You're right, we should probably measure it first. You state that the simple > joins and filters are probably cheap which I don't doubt. We also do > correlated subqueries and stuff. Actually, we also use the baking mechanism > to cache some of our own processing which goes into the construction of the > query. > > However, if the QueryContext is the important part then it may not matter. > We'll time it and see what happens. My question was mostly whether the "spoil > but not spoil" approach might be a quickwin. > > Have a nice day, > Martijn > > On Wed, 14 Nov 2018 at 14:54, Mike Bayer <mike...@zzzcomputing.com> wrote: >> >> >> The two things that the BakedQuery caches are the QueryContext, which >> is the thing that Query creates when everything it needs is ready to >> go and is by far the most expensive part of the Query, and then >> indirectly it caches the string SQL which also cannot be generated >> until everything is ready to go. That is, there's not much to cache >> before you're ready to generate the SQL. If you're looking to just >> cache the overhead of calling the join() or filter() method, that is >> something, but this would need some new mechanism of having that be >> cached as well within the bakery, e.g. a Query by itself that's the >> result of some series of steps. It might be something you'd want >> to play with if you really want to hack on the internals of the >> BakedQuery but I'd recommend doing some code profiling up front to see >> potentially how much savings you'd really get, because I'm not sure >> it's that much. If you have a limited number of Ns, then it's >> probably not worth it. >> >> >> > -- > Martijn van Oosterhout <klep...@gmail.com> http://svana.org/kleptog/ > > -- > SQLAlchemy - > The Python SQL Toolkit and Object Relational Mapper > > http://www.sqlalchemy.org/ > > To post example code, please provide an MCVE: Minimal, Complete, and > Verifiable Example. See http://stackoverflow.com/help/mcve for a full > description. > --- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy+unsubscr...@googlegroups.com. > To post to this group, send email to sqlalchemy@googlegroups.com. > Visit this group at https://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve for a full description. --- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.