Skip to main content

Busting Data Modeling Myths: Truths and Best Practices for Data Modeling in the Lakehouse

Summary

  • Myth busting: This video tackles the top 10 myths surrounding relational and dimensional data modeling, clarifying what Databricks lakehouse truly supports today.
  • Enterprise features: Databricks now supports primary and foreign keys, identity columns for surrogate keys, and column-level data quality constraints—features many thought were lost in the move from warehouses.
  • Medallion best practices: Using medallion architecture (bronze, silver, gold tables), this video explains how to design scalable, high-performance data models for enterprise analytics in the lakehouse.

Busting Data Modeling Myths: Truths and Best Practices for Data Modeling in the Lakehouse

Watch: Busting Data Modeling Myths: Truths and Best Practices for Data Modeling in the Lakehouse
Talk by Kyle Hale, DBSQL Product Specialist, Databricks ; Shannon Barrow, Practice Lead, Databricks
Unlock the truth behind data modeling in Databricks. this video will tackle the top 10 myths surrounding relational and dimensional data modeling. Attendees will gain a clear understanding of what Databricks Lakehouse truly supports today, including how to leverage primary and foreign keys, identity columns for surrogate keys, column-level data quality constraints and much more. this video will talk through the lens of medallion architecture, explaining how to implement data models across bronze, silver, and gold tables. Whether you’re migrating from a legacy warehouse or building new analytics solutions, you’ll leave equipped to fully leverage Databricks’ capabilities, and design scalable, high-performance data models for enterprise analytics.
Here's more to explore:
The best data warehouse is a lakehouse: https://www.databricks.com/product/databricks-sql
How to migrate legacy data warehouses: https://www.databricks.com/resources/ebook/migrate-your-legacy-data-warehouse-databricks
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements

Chapters

FAQs

What are the top myths about data modeling in the lakehouse?

Common myths include beliefs that lakehouses don't support primary/foreign keys, transactions, or data quality constraints. This video clarifies what capabilities Databricks lakehouse actually provides today.

What advanced features does Databricks lakehouse support?

Databricks supports primary and foreign keys, identity columns for surrogate keys, column-level data quality constraints, multi-statement transactions and other features previously unique to data warehouses.

What are best practices for data warehouse migration?

This video debunks misconceptions about lakehouse modeling revealing that thoughtful schema design remains critical despite system flexibility. Applying time-tested warehouse principles like dimensional modeling and data contracts to lakehouse tables ensures consistency. The video emphasizes that modeling excellence amplifies benefits of modern storage and compute.

How can organizations modernize legacy warehouses into real-time platforms?

This video shows that migrating to real-time analytics requires rethinking architecture from batch-oriented pipelines to streaming foundations. The Databricks Data and AI platform enables processing data in real-time while maintaining governance and performance. Gradual migration from existing systems reduces risk while capturing real-time benefits.

How do I quantify costs of moving data between lake and warehouse?

This video helps organizations evaluate migration economics including data movement costs, compute expenses, and operational overhead. Understanding these trade-offs guides infrastructure decisions between data lakes and warehouses. The video emphasizes that total cost of ownership includes more than storage, requiring comprehensive analysis.

Full transcript

0:00 Introduction and agenda

Welcome everybody to data modeling on data bricks lakehouse myths truth and best practices before we begin forwardlooking statement we're going to say a lot of mights wills cans shoulds etc like no guarantees uh don't plan on them but plan on them okay all right um and yeah please complete your surveys feedback's really critical here at summit we love feedback good bad the It's fine. Uh, just go to your my sessions or my surveys tab in the data bricks event.
Find the session, give us feedback, give feedback to all the sessions you attend. Thank you. Cool. So, intros. I'll I'll go first. I'm a lead product specialist here at Data Bricks. Uh, focused entirely on behind data warehousing. Been here three years, been in the industry for 20. Uh, and excited to tell you today about some of the myths of data modeling on data bricks. Hey guys. I I've actually spent six years at data bicks.
I'm also one of our SMMES uh in the DBS SQL side. I do a lot in our data engineering. Technically, I'm in the RCT vertical as a practice lead. And I really wish would have brought his hat today. That's a really cool one. I won the I won the photo battle. So, that's good. So, all right. So, why are we here today? Uh so, the evolving data landscape from warehouses to lakehouses, right? So, I I think we want to explain like first off the myths, the features that you lost or you thought you lost when you went from a warehouse to a lakehouse, but actually exist on data bricks today. uh and also some of the best practices around uh just kind of modeling in general like things that you did in warehouses that like maybe you don't have to do anymore or something like that.

1:11 Lakehouse overview

We just want to really dispel those myths. We hear them a lot um from our customers and uh sometimes from our competitors and then also just new features that have that recently have closed those gaps, right? So we do have as you probably know like we're we're an evolving warehouse. We just built our first warehouse product DBS SQL released in 2020. We made a lot of progress. It's a a world-class leader in TC on performance but there's still some features that we're continuing to add.
We're not we're not done. Nobody's done adding anything to their warehouses, but we have added some recently that have kind of closed some of these gaps with legacy warehousing tools we want to let you know about. And then uh Shan's going to kind of go into some practical considerations about the Medallion architecture and best practices for performance and optimization of your data lakehouse to assist with data modeling.
So we'll do kind of a a demo kind of a it's kind of in the can demo that the channel will do and kind of walk through how to apply some of these best practices and then we'll do some some Q&A. Okay. So a quick refresher on the lakehouse. Hopefully everybody here is super familiar with lake house but I just want to like point out one things is like you know we really pioneered this lakehouse which you know solved a lot of problems and one of the ones is you know the open data lake and that's kind of where our you know DNA started is like data lake solved for problems that traditional data warehouses didn't have such as scalability and being able to kind of just like operate over big data right we had the three V's and the five E's and at some point there were like a lot of V's uh and we used to talk about those a lot with the data lake but data lakeink wasn't enough to solve these problems so you know you did have unified storage and a nice piece but then you needed something on top.

2:21 Addressing data modeling myths

So, data bricks has come up with the concept the lakehouse. We had unified security governance uh and cataloging with unity catalog and then on top of that we've got a bunch of different compute engines data science and AI. It's the last time you're hear about AI in this talk uh ETL and real-time analytics orchestration and of course my favorite data warehousing and we've built all of these kind of with the idea that they really don't need to be siloed by compute or product.
We want them unified in terms of the data, unified in terms of the experience of a of an analyst who goes from data ingestion and transformation to data warehousing to potentially even building um you know uh machine learning models and real-time analytics on top of those as well. So we want those all to be kind of unified in one experience. And so the lakehouse provides a lot of advantage to that. One, it can operate over lots of different kinds of data, right?
It can operate at different speeds of data, real time, streaming and batch all in kind of one unified interface. Uh and then two it can work on uh non-traditional kind of formats and it can also serve up all these kind of use cases all under kind of one roof. So really really powerful but uh you know there's some myths about this and we want to kind of like address these and reconcile. Okay so myth number one the data bricks doesn't support relational modeling.
I actually hear this all the time is that oh oh this is like a data lake so your data needs to be like in JSON formats or unstructured formats datas only and you know when you're doing traditional tables you know you're going to need a proper data warehouse right and the truth of the matter is that relational principles are critical for organizing your data that's why we called it a lake house and not just a lake is is the key concept here is like this is like organizing your data in in structure actually provides meaning to business users but also systems um and it's really really critical so relational modeling just didn't go away just with the lakehouse.
In fact, it's more important than ever because your data is getting bigger and better than ever. The sources are coming in are variety are bigger than ever. You need some way of modeling this data to understand the relationships between them. That's what relational modeling does. Delta Lake supports acid transaction schemas and more. So, Delta Lake itself, some people think of us as, you know, they kind of like with CAP theorem, right?
Or or like a document database or MongoDB, but we're not like that. Every table in Delta Lake is a standard table. It works atomically. It works just like ACID transactions. It's it works just like any traditional database table has those same constraints around acid for isolation and things purposes like that and so it works just like tables for relations as well. Then the other piece is that materialized views and metric views our new product uh they depend on relational modeling they depend on it to incrementalize updates.
So a materialized view is joining two different tables expects those two tables to have relations between them so it can figure out incrementally what rows it needs to update inside that overall materialized view. And the same thing for metric views to operate over an entire model to be able to kind of say here's a single model that consists of relations send submit a query to it and then have it decompile that into those joins of all those different tables requires a good relational model.
And then finally uh most AI oh sorry I said AI one more. Okay so AI models and feature tables still rely on structured tabular data. This is just true. Uh yeah unstructured data is always going to be there. We we do support that. We're really great with it. But structured tabular data really is the heart and soul of most of the data intelligence platform that we always talk about. And so relational modeling is a key concept there, especially when you're engineering features and trying to maintain them over time.
The concepts of dimensional modeling and just slowly changing things, those still apply to things like features and the model data that sits underneath your your AI tools. Okay, so myth number two, you can't use primary and foreign keys. So for those of you some people don't know, but data does have primary and foreign keys. You can set them directly in code in SQL um and uh and pispark uh directly over your tables. Uh and today they'reformational only.
So this is the truth about them, right? We don't enforce the constraints there. But you can use a rely keyword if you are managing reference integrity. So what that means is when you create a pipeline, you say this set of dimension for example has primary keys. This fact table has foreign keys pointing to that dimension. If you are maintaining that every row in your fact table has a corresponding row in your dimension table and has a foreign key primary carry relationship between it.
You add this keyword. Our engine takes that hint and optimizes joins between those. It converts them to inner joins. It eliminates joins uh when they're no longer necessary because it can understand that if there's two joins here, but this is really just the exact same set of values. It only has to look at one side of the values to figure it out. And so we can actually leverage that hint. But also enforce constraints are coming.
I remember a forward-looking statement. I have no idea when, but they are working on it. It is actually going to come out sometime. I'll just say roughly hopefully within the next like nine to 12 months, but it is going to be probably a priority in the next couple of quarters to get started on it. Um ask your friendly account team when we have private previews. We will do enforce constraints at some point. So myth number three, column level data quality constraints are impossible.
So the truth is is that you do have check and unique constraints as well. So you can have a check constraint which specifically is like a boolean operator that says you can't put a you know a negative number in to a quantity field for example or you can't put a date below a certain range. We won't accept dates maybe below like 1900 into a date field. So that's a check constraint. You can also do unique constraints. Um and constraints are enforced.
So when you when you do put in a row, you know, put in a value that is in to a column that has unique constraint and it violates that won't let you add the row. You can go beyond this with native constraints though, right? So we have lakehouse monitoring. If you guys haven't turned on lakehouse monitoring, you don't have to turn on every table, but for the tables that are really critical, those are usually going to be like your fact tables or tables that are feeding into like feature tables and stuff like that.
Um, if you turn on lakehouse monitoring, you can actually do custom expectations and data quality checks. So things like nulls or again values outside of a threshold or if the average value is drifting in some direction and you can use lakehouse monitoring to automatically detect those and then we put those data quality checks in the unity catalog explorer so you can see them. We also send alerts when something falls out of one of those constraints.
So lakehouse monitoring is a really great way to just turn onto a tool and get a lot of what I would call the basics the table stakes of expectations and data quality. But you can go beyond that. We have this really awesome labs library. We just released it in January called DQX. Um it's for custom data quality on tables as well as Spark dataf frames. Uh it's really robust. You can literally write any SQL command or condition and have it apply as a data quality check.
You can write PIS spark as well. Um and seriously give it a shot. Uh it's free. It's in our data bricks labs library. Uh if you just go out there and just search for data bricks dqx you'll you'll find our links to it there. Give it a shot. It's a really great tool. Uh and it's totally free. Uh while we continue to ultimately kind of roll this into lakehouse monitoring. So this will eventually will become part of the end product.
But for now, if you really need something just not available in lakehouse monitoring and kind of the available metrics, uh you can knock your socks off with DQX. Okay, myth number four. You can't do semantic modeling without proprietary BI tools. Okay, that was literally true about six months ago into private preview. Now we're in public preview with Unity catalog metric views. So we do have our own version of semantic layer.
And the cool thing is um is that signage to the catalog, right? So we have dimensions and measures. We'll have joins. Uh you'll be able to do nested metric views, so kind of metric views on top of other metric views. Um so we're thinking like composable kind of metric views, especially in large enterprises. U and it'll work out of the box with our AIBI dashboards genie and in data brick SQL. So and when I said data brick SQL, that's actually wrong.
So it's like I mean it is data brick SQL technically. It just works with SQL. So it's literally SQL code that you write that then in turn, like I said earlier, when you pass it to our engine, it decomposes it into the underlying joins of a regular SQL. So, it's a really cool uh functionality, but the main thing is tying your semantic layer to a catalog. It's a major improvement over tying it to a specific BI tool because now uh you know, especially in the coming age of I said it again, okay, agentic AI, I won't say it anymore. uh but you know when we talked about semantic layers you know we've always been talking about from a BI platform angle but semantic layers are even more critical for AI agents who are going to one generate BI for your customers two be assistants and genies who live next to your customers when they're doing BI uh by themselves and consuming it and then also just agents just living out there like doing their own workflows and orchestrating things on your behalf they're still going to have to understand a semantic layer they have to understand your logic your business clauser your definitions your metrics uh and these semantic layers are going to be really critical for it so tying to a catalog and not to a single BI tool.
Pretty cool. All right, myth number five. It's kind of weird slide angle. Okay. All right. Yeah, you shouldn't build a dimensional model in data bricks. Okay, so we talked earlier about relational modeling, so we support this, but like some people are like, okay, but you should just build like one big table, right? Like every like joins are bad and we should just flatten this all out. I get this question probably more than I should.
Uh dimensional modeling principles are highly effective for analytics. they still like just there's nothing that beats them if you have a good understanding of your logical model. So if you have a good understanding of logical model and you can build a good star and snowflake schema those translate really well to delta tables. We love star schemas, Delta loves star schemas, parquet loves star schemas and our engine is actually designed for uh dimensional models as well.
So managing slowly changing dimensions, snapshots, all those things are still true and you still need uh you know those traditional benefits to really take the you know to understand dimensional modeling as a value ad in data bricks. We really support it. Do you always need a dimension model? No, but you should always consider it first. You should rule it out. Okay. Uh last one and then I'll turn it. Uh you need a separate engine for BI performance.
Okay. I hear this one a lot. Okay. You guys can do really good with this ingestion and transformation. And we built a silver layer and everything and you told us about the gold layer but we decided to serve that up in some other tool. Uh so delta tables are based on columner files. We just said that earlier they're based on parquet right photon engine is designed around OLAP queries and pruning data based on dimensional modeling.
We actually do the exact same things that all your warehouses do. We just do it a lot cheaper and faster on specifically on large data sets because pruning data is is mostly a matter of like having to open files in in our world. We do a really good job of pruning files and skipping that. in other engines they're they don't really have that luxury. They have to honestly spend a lot more time kind of dealing with their data uh pruning aspects to get those to work well especially on very large data sets.
So photon engine specifically designed for the cube queries and BI queries of dimensional modeling right out of the gate and we easily scale for high concurrency workloads. That's the other thing. We have serverless SQL we can absolutely scale as many users as you want to throw at it through a BI tool. We can absolutely handle okay uh that is it for my section of the talk. I'm going to turn it over to now. is going to kick a few more myths and walk his demo through.
Thank you. So, how many have seen this chart before? Right. So, is a medallion architecture required? It's in my opinion, it's a little bit more of a guideline. Okay, it's it's kind of a reference point for what you want to do. Okay, it and let's be honest, we've all seen this chart even in traditional data warehousing. It's all doing nothing but pushing data through curation. It's everything from raw. Let's clean it up. let's keep an original copy that's perhaps all the changes over time now I have an audit history or if I need to go back for some sort of data quality issue that happens later and fix something or if I have um you know schema evolution that happens over time I'm keeping the original copy of data but then now maybe I want to curate it I want to put some data quality to it I want to put uh you know slowly changing dimensions type one type two even type six or something if you want to start doing that you could do that at the silver layer right but then you have gold layer gold layer is a little bit more about your consumption layer.

12:52 Medallion architecture perspective

Maybe I want to now start applying optimizations. I want to cluster my data. I want to apply different things that are going to make it performant from a BI tool or from an application ad hoc type use cases. But then what we also see is that like a lot of customers end up saying, well, I want to start doing some more curation. I want a platinum layer. I want to start doing extra things to try to make my applications work extremely well.
Maybe I want to do a data vault or some other modeling uh layer inside of maybe my bronze and silver. and then now I want to expose that more as as a snowflake layer or something like that. Right? So there's usually a little bit more flexibility when it comes to how you want to build out your pipeline. It's not such a hard and fast rule that you have to follow this medallion architecture. It's just kind of a reference point in my opinion.
So this one we had seven they told us to do seven miss by the way. So this is our our bonus eighth, right? This one's actually it was a a true until until this week, right? So we are actually announcing our multi-statement transactions this week. Um the multi-statement transactions are going to come in cases where you know let's say your company is ingesting change data with Kafka for over a 100 different delta tables right and so to maintain concurrency what you've ended up building is custom logic that uses batch ids or views to ingest that data.

14:33 Multi-statement transactions

It ends up being a little bit brittle, pretty expensive. But now with multi-statement transactions, you can now publish updates to all your 100 tables at once, right? So get auto atomicity by default and eliminate all the custom logic. Or let's say your company does supply chain planning. Uh you need to update multiple related tables at the same time and enforce the foreign key and and primary key relationships that was talking about earlier.
So previously you would have had to actually write that with a lot of different custom logic. You find and delete orphan rows, things like that. But now with multi-statement transactions that are in preview, you'll be able to update the tables with an all ornone semantics. So there's a talk here at data summit specifically around this topic. Um you know if that topic interest you encourage you to attend but there's multiple ways that we actually try to improve our implementation over a traditional data warehouse.
You know instead of using locks we use you know optimistic concurrency let your workloads run faster. um strong isolation support for open table formats on your own cloud storage which ends up being fully decoupled and flexible and there's other other built-in here that you see on the chart. So moving kind of from the logical data models over into more physical data models. Let's talk about how we can try to keep the lakehouse optimized.
So this part I'm actually gonna have to switch over in a minute. I'm going to have to switch the screen from like an extended screen over to a shared screen on this one because it's going to be really hard to do a demo like that. Right? So, one of the ways to improve performance though is is by reading as little data as possible, right? So, when you start talking about how do I cluster data, right, to make it performant, you've built out your logical model.

16:14 Performance and optimization concepts

This is how my data gets joined together downstream from BI tools. Um, how do I get good static pruning? uh for those uh who who uh aren't familiar with the difference between static and dynamic pruning. When you do static pruning, this is very much things like filters. It's a wear clause. It's a very explicit thing you're telling it to filter by. Lot of times in BI tuning, what you want to have is so BI tools will actually read it via join.
So you need to go join to a reference and table keeps going up. you end up joining to a table and then you want to have that dynamic value that comes back from filtering that other table to then go to your fact table and start pruning results. And so what happens is we'll read the dimensional the reference tables bring back the explicit values push that down to the file level into the into the fact table to make sure that you're getting good performance.
So that's the dynamic file pruning. So liquid clustering and partitioning. So liquid clustering is is a little bit newer. Um, the traditional hive style partitioning is actually still very valuable. I use it probably more than they like. But the liquid clustering capabilities means that you are a little bit less tethered to what your commitments are. You're a little bit less tethered to, you know, having something that's low cardality.
If you want to choose things like, I don't know, a product ID, for example, and you've got millions of products, that's that's a completely fine thing to cluster by now. But that would have been very problematic as a partition, right? Um you know the one of the bigger challenges I see is customers who choose too many clustering columns or trying to pick the right ones. Uh what you end up seeing is that there's a little bit more of a a logarithmic increase in the amount of uh you know splits that need to happen at a certain data size as soon as you start picking too many columns.
So in most cases in your if you're in the low gigabytes or 100 gigabytes 500 gigabytes even it's probably best only to choose one column. I wouldn't start getting into the multiple columns for clustering until you get into the terabyte size because of that logarithmic increase. You as soon as you start actually needing to have more files and you have cardality then it becomes problematic. So one of the other kind of under it's under the hood uh choices you could pick is your target file size.
So if you are choosing how much let's say you've got cardality columns that are in the um in the hundreds or thousands but you know you want to try to pick a file size that when you load it actually ends up being in that magic number in that ballpark of what your cardality is for the columns you're choosing for clustering right so then you can go and toggle your target file size and say hey you know what I need to be as low as maybe 32 megabytes or as high as a gigabyte for long time our default was a gigabyte on the target file size and table stats table stats actually ends up being pretty important and very often is uh is overlooked by customers.
We're going to touch on on these two here in a moment in the demo. So, I'm going to jump right ahead. Okay, just give me a moment. So, what I'm going to show you here, I've already run these today, so I didn't have to actually run it live here and face a mistake, right? Um, so what I took is a benchmark to show some data engineering and we're going to try to do some tuning on the on the consumption side, figure out exactly what we what we want to do to try to make our queries performant.

19:33 Optimization demonstration

So this was the original job that I ran and I made a copy of it. And so the reason why I made a copy of it is because then I'm starting to choose things like I want to now cluster by this or I want to actually choose different ways to actually cluster by or optimize this table. Okay. And so if I come over, I've got a the first one that I did was to get a baseline. All right, so if we look at we don't do any predictive optimization.
We we don't do any stats. There's no clustering involved. All right, we look at queries. These are the two types of queries you're going to see me running in here are two distinct type of queries. I'm going to run them cold. I'm going to run them warm. And then I'm also going to run a BI like query and ad hoc type query. So the ad hoc one is like, hey, I'm just trying to pull back one row. Okay, it's it's a user that says, "I just need to go get one value."
So, it needs the you know that needle in a haststack capability. I need to go pick out one individual thing, bring me back that result. I want it to be fast. The BI like query, which is the one down here, is where I want to I want to choose values I want to get by choosing different um categories or variables that might come from a dimension or reference table. Right? So if I in this case I'm picking out I want retail customers.
I only want active companies. I want active securities. You know is the current version of this sedd type two record. So I'm kind of pulling out all these different things I might filter down from. And then down here with this trade table I'm ensuring that the only thing I'm doing is picking out a specific year but everything else comes from a specific um join. So here I'm actually just joining to my CTE to pull back only those security IDs that came back from the CTE statement.
Okay. So it's very much like a BI type query. So we come back. I'm not going to show you the it running right now, but if we come back, I'll pull this out. Actually, it's probably easier to do this. So here's what the baseline looks like. All right. So if you look at the SQL performance of running this uh with a baseline to when we actually turn on predictive optimization. So the first thing we're going to do is say, let's turn on predict predictive optimization.
I'm not going to cluster at all. So really the only thing predictive optimization is doing at this point since I didn't pick any clustering columns is that it will do a couple of main things that come kind of come later which are vacuum and optimize but those aren't going to happen as soon as I load my data which I did this morning right so what it's going to give me those stats remember earlier I mentioned hey make sure you have stats on your tables these are the spark open source you know uh basically the table stats these are different from delta stats so the delta stats are actually at a file level table stats tells you hey what's the cardality of this table, what's the minimum, maximum, and the whole table for certain columns, things like that.
Okay, but just by having stats correct, it can build better plans. All right, and just by having stats, we actually improved our performance on warm queries. Okay, 4. 6 6 times faster for ad hoc and 2. 3 times faster for B at like okay so then what happens if we say all right I want to now do a cluster by okay here left now it's not working good all right here's no clustering got it all so here we go this is the section where I'm so is Does anyone familiar with what eager clustering is?
Anyone? Okay, we have some. It's not. It's kind of one of those under the hood type things too. So when you cluster a table, okay, you tell these are all the commands here. Here's my alter table. I want to cluster by this command or this column. What'll happen is if you were loading data into it, it will automatically cluster that data on right. So eager clustering is the same thing as cluster on right. Now you can imagine if if I'm loading data over and over and over again that cluster on right only affects that one batch that I wrote.
So now that's where the optimize commands come in is now I can actually make sure that the whole table has tried you know been able to get clustered and optimized. Okay but here all I'm going to is just that optimized uh you know cluster on right approach that eager clustering okay so what kind of results did we get with that? Well, now we've actually taken it from 18. 7 on average. These numbers are the average, by the way, since the cold and the warm combined, but the warm curries are the ones you're going to see the biggest uplift on.
Um, it goes from 18. 7 to 11. 9 when we just did the no clustering and then now 6. 5. And that's only with the eager clustering. So, one one thing I always point out is like, hey, you know what? People think that keeping your your data optimized is really hard or it's expensive. But if you notice on the right, I'm tracking how long this pipeline takes, right? To load this data is not free. But you can see it only went up by less than a minute by getting stats.
It went up by less than a minute more. And now I have my table actually clustered, the full thing. So now I've improved my performance by up to 20 times for ad hoc queries or warm queries and three times faster for BI like. Okay. So, actually I did have one left. Now I've got two left because I want to show the other one too. But all right. So let's talk about what happens if we run optimize. So this one didn't improve it that much because remember this was just one batch.
It did a cluster on right. But it does help some, right? So maybe it didn't do it the most optimal way on the original cluster because it didn't have stats on the table at all. It didn't know what the tree was supposed to look like, the KD tree under the hood for the uh for clustering. So let's just run an optimize command. And then now if you look over here now we see results again. It did improve it a little bit. Okay, you went from 6.
5 to 6. 3 or 8. 7 to 7. 7. Okay, but I think I this to me tells us kind of the power of the eager clustering step. It did a really good job. And then the last one I want to show you guys is I turned on it almost didn't get ready. I don't know if the second table got ready yet. This one definitely did. So I turned on auto, right? So autoclustering, if I come up, I can show you what the commands look like. So if you see here, remember earlier I choose I chose columns for every one of these.
I said, "Hey, this is the column I want you to cluster by." But in production, it's a lot easier just to say cluster by auto. You figure this out, right? Use AI. You tell me what what this thing cluster by. Oh, you said AI again. Oh god. Is it We should turn this into a drinking game. So here I turned every one of the tables into a cluster by auto and I reloaded the data. Right? Now you have to run queries after. So what I did what I did was made sure to run if you look up here the steps here is to run the queries I think at least 10 times.
So I I ran each one of the queries 10 times and I waited about an hour. So if we come back over and take a look at here is my schema for all this data. Okay. If I come over to details you'll see that predictive optimization is enabled. Okay, you can actually change this in UI too. Right now I don't have a warehouse on so I can't actually start it. Okay, but if you have a warehouse started, you can choose this and it'll actually um change your predictive optimization from right here within UI.
Okay, now if we look at dim trade right so earlier you heard talk about primary keys, foreign keys, you know the lineage, things like that, right? If you take a look and I can zoom in here for us. You see the stem trade table because I have primary keys and foreign keys on this table. I have relationships out. This is the fulls um you know entity relationship diagram. I can see everything it's matched to in every other table just by the pipeline being built.
Okay. And if I come over to details I'll see that I still have predictive optimization enabled. I'm choosing cluster by auto. And now what you see here is earlier where this said cluster by empty brackets. Okay. But then if I come over and take a look at history, bear with me. I'm using a two extra small. Um now if you take a look at the history here, it took about an hour and a half. It went from 10:23 a. m. when I did that command for cluster by auto.
At 12:06 is whenever the background optimization kicks in and says we know what you want to cluster this by. Right? If you take a look back the original test I ran this morning was at 919 with the other where I explicitly chose the clustering columns. This was the security ID and account ID. Right? This time it it chose security ID and date ID. All right? So it did choose two different column. One of the columns is the same.
But if you go and take a look at our script, the reason why it's a different one is if you see down here, it's actually choosing based on a year, right? So it's saying, hey, I want a year to be 2015, right? And so in this case, it said, you know what, that's just as good a value as the other column. And when I ran this query to find out what the performance was, I got 3. 77. Okay. And I think that I have this spreadsheet in the other sheet.
Oh, wait. You know what? I have it up here. It should be down here 2. 88. So it was a little bit worse. All right. But it still chose a good column because that was actually in the explicit filter by statement. Right. So here I still improved because the original queries for this for this one was over seconds even warm. Okay. So I just wanted to show the power of actually choosing the automated approach here too. All right.
So we talked about predictive optimization automatic liquid clustering. We've also had some uh advancements in our workload management tool um you know that tries to keep all of your queries fast as well. These are all things that work behind the scenes that you don't see as a user. But in the end you know we fully support robust data modeling uh we've got relational and data um you know dimensional model uh modeling principles in the lakehouse primary keys keys multi-statement transactions full modeling support for data ball uh you know whether it's a snowflake schema star schema and various different ones.

29:38 Conclusion and takeaways

Uh we also leverage data cures for integrity and performance. And then we've also shown how you can design uh some out of the box capabilities to keep your jobs and your tables performant in production. Thank you.

Learn more about the Databricks Data and AI platform.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.