Smarter in\_query

Steven Talbot · Friday Demos · November 14, 2025 · 4:15

We tuned up in\_query to improve query optimization on non-dependent tables. Should be mostly silent but just much faster for complex dynamic queries.

Try it yourselfThe full week on docsmodelingperformance

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. uh demoing two things. Uh one is kind of a small one and is in production but uh is maybe I threw it in there because it's just a link and so like what could go wrong? Um but it need uh surprisingly there's a lot of cases where you various linking to GitHub or GitLab like the name of your model that models have different names.

  2. You can customize the path of your model or not. So I have a feeling that this may not be working fully in all cases because it's not working on omni.momni when I just checked but we'll fix that up. Um the the but the the idea is that you have this deep link to GitHub from from the IDE which hopefully makes it quick to go to PL.

  3. Uh there's the next one very uh deep cut omni demo very specific thing. Um if you're using this pattern so I have this orders view and I've got this case when orders user ID inquiry then something from the users tables null and the way it currently works if you don't have a this flag that I'm shipping on is right we we render the SQL over here we've rendered null because it's not in the query but we joined in users anyway even though we didn't actually need to join in users to do anything because it got random heard out of the case statement, we're just selecting null.

  4. Um, if we uh if we uh enable this new feature which is behind this kind of model feature thing that I this this gesture because it it's a little fraught uh and it's new. But if you we enable this and then go back and I spelled enable right. Yeah. So it now it it basically doesn't it it knows it was smart enough to get rid of the join after rendering it and it realized that it didn't need it.

  5. Um now there's there's one other really nasty case which is then I've got this and I know it. So um this case if we go down how this field is defined uh this is using view.inquery and the way view.inquery is implemented is it it checked uh implicit dependencies. So this is basically a redundant case statement because it's saying if users if anything in the users view is in query then do this else null but this is a reference.

  6. So it considers this to be in the query and you kind of need this pattern to implement certain obscure like emulate certain obscure liquid patterns. So anyway, second feature flag uh that we added to do view and query explicit only. So now if we go back it does what we hope it does where it it does not consider that reference to be a view.

  7. The view is only considered inquiry if one of its fields or filters are actually being used explicitly in the query. The real feature that most 98% of people are never going to need, but if you need it, you really need it. So, there you go. Stephen, is the idea these feature flags get deleted and they're just how it works?

  8. Uh, this just join eliminates. your perspective on the joint elimination one. Yes, probably once we feel confident in it. The other one is a backwards incompatible J change. So sadly probably no. But if it keeps coming up and people are confused by it, we will maybe somehow make it more discoverable or a top level flag or something.

  9. But if it's also if it's this thing that only like three ever need to do ever, maybe not. So So we'll we'll see.