Skip to main content

Get the Most of Your Delta Lake

Summary

  • Delta Lake features: This video explores Time Travel, Column Mapping, Deletion Vectors, Liquid Clustering, UniForm interoperability, and Change Data Feed capabilities that maximize performance and data management.
  • Performance optimization: This video teaches when and how to use Delta features like shallow clones for cost-effective testing and deep clones for complete data versioning.
  • Data architecture: These capabilities transform your lakehouse environment by simplifying data management and enabling advanced analytics across the Databricks Data and AI platform.

Get the Most of Your Delta Lake

Watch: Get the Most of Your Delta Lake
Talk by Youssef Mrini, Solutions Architect, Databricks
Unlock the full potential of Delta Lake, the open-source storage framework for Apache Spark, with this video focused on its latest and most impactful features. Discover how capabilities like Time Travel, Column Mapping, Deletion Vectors, Liquid Clustering, UniForm interoperability, and Change Data Feed (CDF) can transform your data architecture. Learn not just what these features do, but when and how to use them to maximize performance, simplify data management, and enable advanced analytics across your lakehouse environment.
Here’s more to explore:
Production ready data pipelines for analytics and AI: https://www.databricks.com/solutions/data-engineering
The Big Book of Data Engineering: https://www.databricks.com/resources/ebook/big-book-data-engineering-2nd-edition
See all the product announcements from Data + AI Summit: https://www.databricks.com/events/dataaisummit-2025-announcements

FAQs

What are shallow clones and when should you use them?

Shallow clones copy only metadata without duplicating data, creating a pointer to the original table. They're ideal for short-term experiments where you want to test modifications without copying expensive large datasets.

How does Time Travel in Delta Lake help with data recovery?

Time Travel allows you to access previous versions of data at any point in time, enabling you to recover from accidental deletions or errors and audit historical changes to your data.

What is time travel in a lakehouse table?

Time Travel in Delta Lake lets you access previous versions of your table at any point in time by leveraging the transaction log. You can specify a version number or timestamp to query historical data, which is essential for data recovery, auditing, and compliance. The log retention duration property controls how far back you can travel—the default is 30 days, but you can adjust this for regulatory requirements.

What are the best security lakehouse platforms for long-term log retention?

Delta Lake provides configurable log retention through the log retention duration property, allowing you to retain transaction logs for extended periods to meet regulatory requirements. You can adjust this setting from the default 30 days to match your compliance needs, enabling both time travel and historical auditing for long-term data governance.

What is Liquid Clustering and how does it improve query performance?

Liquid Clustering automatically optimizes data layout based on query patterns, improving performance without manual intervention. Unlike traditional partitioning, it adapts dynamically to your workload.

Full transcript

Hey, can you hear me? Uh, you think should Yeah, all good. Perfect. My apologies for the for this small delay. Uh, we had some issues. Uh, welcome to the session about the how to get the most of your Delta Lake. And before we start, uh, how many people have already used Delta? If you guess okay now you're not allowed to raise your hand. So I'll be talking about about a bunch of features that you can leverage. Maybe you're not you you don't know them but don't worry uh the slides will be shared.
So if you don't don't bother yourself take pictures the slide will be available later. So the first uh feature I wanted to talk about are the clones. So the clones are super super important and we have two types of clones. The first one are shallow clones. And basically shallow clones are used to copy metadata only. Why should I use shallow clones? Let's support you. Let's suppose you're a data engineer. You want to try some stuff.
Basically, if you are using a large table, you would need to copy the entire table which can be very costly and expensive. So what you can do you can just do a shallow clone and basically what will happen you will just create a table an empty table that will point to the original one which means zero uh copy and if for some reason you try to update the table you created only the metadata will be updated and you will not be able to modify the existing one.
So basically if you say my table say 1 2 3 4 you try to update like one by removing this line that will in the new one it will be removed but the original one won't be touched. It's like a pointer for those who know like C lang C C language and how can I use it? It's basically you have Python API and the SQL API just mention shallow clone and you can specify the version you want to you want to do you want to clone and keep in mind that if for example I create a table I did the shallow clone and then I updated like the original table keep in mind that your shadow clone table version won't change why because when you did clone the table you did clone the latest version which was for example version number seven but after doing an update it's now number eight which means you still shall cling number seven.
So this is something to keep in mind and when to use it it's mainly as I mentioned for short-term experiments you want to play with your data without messing up with the original one and without having to copy the entire data which can be expensive. The second option are deep clones and deep clones this is literally hard copy of the data which means you copy the logs but also the entire data again you can use it for like uh for archiving or maybe for data migration let's suppose you're on hive meta store and you want to migrate to unity catalog you can for example use uh deep clone and also for data archiving for example you need to keep uh like a version like a snapshot for every uh month.
So you can at the end of the month schedule a job that will run like deep archive like or like deep clone the latest version and you're good to go. Which means after one year you're going to have 12 versions and you can still have a look at the history of this table just like describe history. You're going to see all the versions you did version one two three four and so on. And keep in mind that it's going to create a new uh log.
We have another one and this one is a little bit underrated but it's a table properties. It's called log retention duration. So basically here we are saying that like each time a checkpoint is written so delta will automatically clear like cleans up the uh the uh the log retention and the default interval is 30 30 days but keep in mind that you can still modify this. Just just bear with me. Don't don't put minutes or hours.
It will always be days. You can put it down for example to seven week to match for example the u the logs that you are keeping in case you want to time travel. But keep in mind that if you if you like reduce it to 20 29 days you will no longer be able to time travel to like day number 30 and when to use it. So mainly you want to ensure that you can perform travel time travel for a specific duration. For example, you can increase it put it to 60 days if you want.
So again it's going to depend on your uh your expectations and what is required from you and mainly of course if you need to comply with retention and regulatory uh for regulatory requirements and we have another one and this one is tightly uh integrated with the first one it's the deleted file retention. So this one is linked to the vacuum operation. So for those who don't know what's the vacuum, vacuum is the operation that you would need to run to get rid of all the interact files that are no longer like required for your table and keep in mind that you need to run this to make sure that you save some storage.
This is very important and basically when you define this deleted file retention so this property will define the minimum duration for which logically deleted files are return retained. So if you define that I will keep it for one week. If I run like a vacuum I know for sure that I at least I will keep the last the the last week and of course you can adjust this based on uh based on those uh specific requirements and we have this data skipping num index call.
Yeah, I know it's a pretty long property, but this one is very very important because this will help you uh like put the number of statistics for the columns you want to capture statistics for. By default, it's captured statistics for the first 32 columns. But for example, you can specify just the first eight columns if you want. Just say num index call equal to zero or you can disable this cap this statistics capture.
But of course it it will impact the performance of uh the per the performance of your table. So when to use it? So it will capture as I mentioned the mean, max, null, null values and those statistics will be very very useful when you're like running very intensive computational uh queries and of course I did mention that you need to capture the statistics for example for the first eight columns but sometimes you can get rid of some specific columns.
What if you have for example a string column you cannot capture like statistics for string column. So what you can do you can if you want alter the table and change the order to make sure that for example all the string columns are put on the on to the right because we because when you are capturing statistics we're starting from the left. So we got to make sure that all the numeric values are on the left and the string and all the columns that we are not we don't support statistics we'll put to the right and then we can just say hey capture statistics for the first two or three columns.
So that's why alter table can be very uh very important and this is how it can be done. You can just say hey put this column first or change the order put it after this specific column or replace the column. So it's super super easy and straightforward to use and as I did mention it's mainly used for performance optimization and it changes schema reliability to make it more readable. And then we have delta data skipping stats column.
And this one is very very important. So I did mention first that delta capture the statistics for the first 32 columns. But sometimes the columns you're targeting are maybe at the end of your table at like the to the right. You don't want to alter those columns. You don't want to change the order. So what you can do, you can just go and specify, hey, just capture the statistics for the columns I will be mentioning. for example, uh age, uh income, and then if you run the if you run the optimize, it will capture statistics for only those three columns.
Or you can you can do more, of course, if you want. And again, when to use it performance optimization and if you have a large table and you don't want to play with the order of the columns, you can just use this specific uh table property. Then we have deletion deletion vectors and this one is very very important because as you know park is immutable but before like delta is park plus some logs and park is immutable.
So if I want to update a specific column or specific row, it's going to automatically trigger the creation of a new file, new park file. And what if you keep updating the table like often? This will be very intensive operation with deletion vectors. What's currently happening? I'm just going to tag this row as deleted. We're going to add a bit map and say this this this row has been deleted. But I won't trigger the recreation of the new file.
I will do it a little bit later to make sure that I reduce the uh I reduce the the number of rewrites. This will help me improve the performance drastically. And then we have change data feed. And this feature I think it's a very underrated feature. But what you can do is just delta. Change data feed equal to true. And basically whenever for example you have I don't know a customer customer data you have for example the name is Yousef the city is Paris.
So what if I change I update the table and I put like Yousef and the city is San Francisco. I can just go and do like select star from uh table change. I will specify the name of the table and it will it will tell me this is the like uh the previous row. It was Yousef Paris and now this is Yousef from San Francisco and the type it's update. So I will be able to track the update and the delete and in which version this happened.
So for example at every single step you can capture the all the changes and propagate them a little bit later. It's basically doing CDC like operation but in Desda. And then we have column mapping. I love this feature and I als it's also uh scares me. Why? Because column feature like column mapping you can you need to enable it to make sure that you can alter the name of the a column because in the past if you wanted to alter the name of the column you had to rewrite the entire data entire table which can be again very costly if you have one terabyte table.
With column mapping you can just alter or drop a column without having to rewrite the data. But when you enable column mapping, you can have like special characters in the name of the column like having a space or having a like a which can be a little bit dangerous if it's at the end you will you won't notice it. So be mindful when using this feature but again it's super important because it's it brings a lot of capabilities and it's also required for advanced features like liquid clustering and others.
And then we have allow uh column default. This one is also super important when you are talking about data quality. You all know that data engineers are very very lazy. Wait. Yes, something went wrong with my slice. I was supposed to update this. Basically with u delta like feature allow uh column defaults you can specify the default value for a specific column. So if I am filling or updating a table if I'm not inserting data in a specific column it will automatically put a specific uh value.
So for example, if you are filling like a table like column date, you can specify like default value current current time, which means if you don't fill this this value, it will be automatically populated for you. My apologies for the slides. I must have shared the wrong one with because of the network issue. And then this is also a super important feature. It's called generated uh columns. But basically this will help you compute a column based on another column.
The example I have below you can see I have a birth date. What I what I'm currently doing here I'm just creating a new column and I'm saying that birth date will help me create a year of birth. So basically I'm just casting the birth date and I'm capturing the year which means whenever I create a like insert data for birth date delta will automatically compute this new column for me and I can use this new column to also to partition uh to partition for example my table if I want and you have two options.
You can either do generate by default which means if I I forgot to fill this specific column for example year of birth it will automatically compute it from this column or I can specify generated always which means even if someone filled this data I will automatically be like uh replaced by the automatic uh uh column compute and then we have identity columns and this one is very very important. Why? because you can create a string like a column that can be like looks like a primary key because this key will be unique and what I'm specifying here is you see that like begin generated always identity I'm specifying that I will start with zero and each time I will increment by one so technically when I do this it will automatically create a unique key it's like starting with zero one two three and it will be unique key but keep in mind that when you're going to be using this feature like identity columns, you you won't be able to paralyze this operation.
Why? Because you need to make sure that the your your uh your primary key that you did set up here is unique. If you're paralyzed, you want to be able to find like it can create duplicates, but it's super awesome feature to use. And that's it. I tried to promote my uh my YouTube channel, so make sure to subscribe. we will have uh good content. And again, my apologies for being a little bit late. And I'm open to all your questions.

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.