In memory cubes (behind flag)

TJ Banghart · Friday Demos · June 27, 2025 · 10:53

Sometimes you want the filter experience to be faster than the back and forth to the warehouse. Now you can create extracts do slice and dice instantly. Lots of work to come here to tune…

Try it yourselfThe full week on docsdashboardsmodelingworkbook

Transcript

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

  1. Yes. Where is it? OK. Let me show you something about caching. I think we talked about this Cube project a few weeks ago on "Metric Monday." This is a kind of first attempt. Let's imagine that we have, excuse me , an inventory representation. We know that it doesn't change very often. We don't really want to access the database every time we view this view.

  2. Let 's take a look. As you can see, I click on it, new columns. This will be a cache miss. Wait. Yes. OK. I'm getting cache misses while exploring this view. But I know it's pretty simple data that doesn't change very often. So I'm going to go into the workbook model and add a new parameter called cube.

  3. Now it's just a logical check mark. I'll set it to true. I'll go back to the workbook. I'll update a little. And now let's download everything. I'll run it without cache. Now we have a split plan: it will run a main query to get all the rows it needs, and queries on top of that will access the caching layer.

  4. Does it work? What is happening? Yes. OK. This is a very large cache, currently the limit is up to a million rows, and this is our test Postgres for e-commerce with a bunch of data. So the first execution takes some time. I hope it really works. I can add restrictions if this doesn't work. Interesting. PJ, as long as it works.

  5. Ahem. Yes. Can I do several of these at the same time? Is this the browser cache or our server cache? This is the server cache. And yes, you can have several; the idea is that you will have multiple query representation caches and then a Cube theme. And if you have a Cube theme, every view in it must also be in a Cube to stay within the context of the re-query cache.

  6. OK. This doesn't work. I'll try again. Maybe just Yes. OK. Here. Let's start. Yes. Good. They are not cached in our regular query cache. This is Cube. So I'm choosing fields that I haven't chosen before . Class. And this is a hit on the cache. You can do everything that is expected: aggregates, etc. Um, but now it's all like repeated requests to the server-side cache.

  7. Hmm, this is just a starting point, we can add more features, like customizable cubes with different caching policies. How does this intersect with , you know, cache expiration or refresh, etc.? Yes. Only default settings are currently in effect . It follows the caching policies you set for the model. It does not yet have its own caching policies for reading queries at the cube level.

  8. So it will just be the default cache . Essentially, it's just a big CL cache running at default settings, but with a split plan. So when you clear the cache, it first executes the query view , and then any other user request. Are there any field types that are capable of getting a um, common theme? Sorry. Oh no, it's a dialect issue because it's currently running on DuckDB.

  9. If you add additional fields that are not in the query view itself , they must be in DuckDB, as this works in a server-side cache. Got it. That is, if I create a new field using SQL, oh, it will almost certainly require DuckDB SQL or something similar. Explain to me, I want to merge first name and last name in the users table.

  10. Yes. To do this, you will have to execute a DuckDB SQL query. If you do this as a new dimension, but if you move this into a query view , it will be your dialect's SQL. Got it. It turns out that you are actually pulling all the materialized dimensions into a cube, and everything on top of that has to be dialect-specific.

  11. Yes. Yes, that's how it works now. Although we could try to implement dialect translation , it is quite difficult. Hmm, maybe this will work because when we requery, we do a lot of casting, for things that we can pass to the DuckDB layer. But there is still a lot of work to be done there . Yes. This is very interesting.

  12. Very, very cool. DJ, you...Oh, sorry. Sorry, Konra. Continue. Well, I just wanted to say that this is exciting, and I like that it will push us to work more actively with caching policies . So, things like proactive cache expiration checking will push us in directions beyond working with cubes, like scheduling submissions, etc. I think it's just great.

  13. This fits into the bigger picture. I like it. Yes. In the same vein, actually, another question, which is exactly similar to the principle of " give a mouse a cookie and ask for more." Will we be able to specify where to place the cube: in the data warehouse cache , on the application server, or even in the user's browser cache?

  14. Yes, I would really like to implement this. If we do a "push down" it will be close to PDTS or creating materialized views. So the planning of this process is something that still needs to be developed. Because right now all we have to do is : if the data isn't in the cache, load it there, but we need a process that runs and checks the internal table to update these materialized views.

  15. But I don't see any problems, it's quite possible. We just need to build this architecture. Perfectly. Where is it now? Can this be put into operation somewhere? Yes, it already works. Yes. The cube parameter, in fact, the checkbox itself , is already in the production environment. The limit is one million rows. But there is an environment variable that we can configure if the need arises.

  16. We process too much data. This is actually already available. Of course. Is it... Is it implemented through a feature flag, or is the parameter just available? The option is available. Yes. We can set the feature flag if needed, as this all works in call services. Class. Class. TJ, have you tried doing anything unusual in terms of volume?

  17. Have you tested or at least had an idea how it works with 100 million rows? Not with 100 million. I set a hard limit of 1 million. I think this is because the initial request to load into the cache took quite a long time. So 1 million seems optimal. you just have to make sure you set up the cache, and as we discussed it in the office, someone could schedule something in the middle of the night.

  18. They would execute this partitioned query plan and then load everything. So , the rest of the day, if your caching policy is long enough. So there are certainly many things that need to be figured out. Could we, off-topic question, I'm thinking of a scenario where someone wants to cache different time slices of the same view. For example, could we think about accelerators like this where we essentially cache daily , weekly, yearly totals and make it transparent and user-friendly?

  19. Yes. Like aggregation or taking into account aggregates . Ahem. Yes, essentially, just automatic generation and caching. Of course. I guess arbitrary measurements. E. Yes. I think so. I need to think about this a little more. OK. It seems feasible. PJ, after a million, it's just ignored? Yes. It does exist, but I don't want people to use it, and it's limited because you can't join it.

  20. The merge should happen in the query view. As soon as someone starts working with this , they get validation errors, which makes it impossible to attach or use outside the context of a single submission. Ahem. Can I clear the cache and refresh to get through this? Yes. This will reset the settings. But the cube will be rebuilt.

  21. That is, there is actually no way to query the database once the cube is configured. Yes. Yes. OK. Maybe it's worth thinking about some kind of hook that would allow this to be done. Of course. Yes. I mean, a hook is an advanced action, right? The hook would be like this: you go into the workbook model and turn this off, right?

  22. Like. Oh, of course. Yes. This is an advanced action, you don't want a random user to just break everything. So. Yes, that's fair. Maybe that's enough. Ahem. This probably requires a switch in the interface anyway. The problem here, Steve, is that when you turn it back on and the cube was in bad shape, you can't test it in real time, and I just want to make sure it can be fixed.

  23. Good.