SlideShare a Scribd company logo
MariaDB Temporal Tables:
A Demonstration
● Why track data changes?
● System-versioned tables
● Application-period tables
● Bitemporal tables
● A word on MindsDB
Agenda
Tracking data
changes
● Auditing
● Travel back in time
● Compare today situation with 6 months ago
● Statistics on data changes
● Find correlations
● History of an entity
● Debug
Tracking Data Changes: WHY?
● There are many ways to track data changes.
● Most commonly, they involve having a consumer that reads the
binary log and send changes to other technologies, like Kafka.
● Great for analytics, message queues, auditing.
● But the changes are:
○ Replicated asynchronously
○ Not available to the application
Tracking Data Changes
In-Database data changes tracking methods:
● Logging row versions into a table
● Logging each value change into a table
● Temporal tables
Tracking Data Changes
Advantages of Temporal Tables:
● The versioning logic is transparent
● Rotation can be automated
● Faster and more scalable
Tracking Data Changes
Temporal Tables
Overview
Existing implementations (I know about):
● Oracle 11g (2007)
● IBM Db2 (2012)
● SQL Server (2016)
● Snowflake
Temporal Tables Overview
Existing implementations (I know about):
● PostgreSQL has a temporal tables extension
● CockroachDB
● CruxDB
● HBase (kind of)
Temporal Tables Overview
● MariaDB 10.3: system-versioned tables
● MariaDB 10.4: application period tables
A table can implement both. It's called a bitemporal table.
Temporal Tables Overview
● Rows are versioned
● Every row has 2 timestamps, the start & end of that version
validity
● INSERT, UPDATE, DELETE modify those timestamps in a
transparent way
● Plain SQL SELECTs only return current data
● Using temporal syntax, we can query past data
System-Versioned
● Works best to describe events with a start and an end
● Especially when some events cannot overlap
● Timestamps are written explicitly by the application
● But UPDATE and DELETE can automagically shrink or split
periods
● Apart from this, they are regular tables that you use with normal
SQL syntax
Application-Period Tables
● Not understanding this damages projects.
● If you work for a vendor, whether you want to say it or not, feel
free to correct any mistake I might make
Temporal Tables Overview
System-Versioned
Tables
● Create a sysver table:
CREATE TABLE tbl_name (
…
valid_since TIMESTAMP(6) GENERATED ALWAYS AS ROW START
INVISIBLE,
valid_until TIMESTAMP(6) GENERATED ALWAYS AS ROW END
INVISIBLE,
PERIOD FOR SYSTEM_TIME(valid_since, valid_until)
)
WITH SYSTEM VERSIONING
;
System-Versioned Tables
Best practices:
● You could omit the column names, but then you won't be able to
use them in queries
● You can use different names, but I recommend you always use
the same names
● You could use visible columns, but most of the times you don't
want to see them
System-Versioned Tables
● An existing table can be made sysver:
ALTER TABLE tbl_name
ADD COLUMN valid_since TIMESTAMP(6) GENERATED
ALWAYS AS ROW START INVISIBLE,
ADD COLUMN valid_until TIMESTAMP(6) GENERATED
ALWAYS AS ROW END INVISIBLE,
ADD PERIOD FOR SYSTEM_TIME(valid_since,
valid_until),
ADD SYSTEM VERSIONING
;
System-Versioned Tables
Best practices:
● Making one, multiple, or even all tables sysver is not a risky
operation - but you never know
● You can do this on a new replica that is used by analysts or
programs that read historical data
● For such replicas it's usually ok not to use an LTS version
● Once you're confident enough, you can make the change on the
master
System-Versioned Tables
● In both cases (new or existing table), it's practical to create one
or more separate partitions for historical data:
ALTER TABLE tbl_name
PARTITION BY SYSTEM_TIME (
PARTITION p_history1 HISTORY,
… ,
PARTITION p_current CURRENT
)
;
System-Versioned Tables
How to delete history:
● Remove history before a point in time:
DELETE HISTORY FROM tbl_name
BEFORE SYSTEM_TIME '2020-01-01 00:00:00';
● Remove whole history:
DELETE HISTORY FROM tbl_name;
● Remove history and make the table non-sysver:
ALTER TABLE t DROP SYSTEM VERSIONING;
● Remove history and current data:
TRUNCATE TABLE tbl_name;
System-Versioned Tables
● GDPR and possibly some other regulations guarantee the
Right To Be Forgotten (RTBF)
● This means that we can't keep the whole history of columns that
contain Personal Identifiable Information (PII)
● To exclude these columns from a table history:
CREATE TABLE user (
…
email VARCHAR(100) NOT NULL WITHOUT SYSTEM VERSIONING,
…
)
WITH SYSTEM VERSIONING
;
Right To Be Forgotten
Application-Period
Tables
● Creating an Application-Period table:
CREATE OR REPLACE TABLE reservation (
uuid UUID DEFAULT UUID(),
bungalow_name VARCHAR(100) NOT NULL,
client_name VARCHAR(100) NOT NULL,
start_date DATE,
end_date DATE,
PRIMARY KEY (uuid, start_date),
PERIOD FOR reservation (start_date, end_date)
);
System-Versioned Tables
● If you don't use periods explicitly, it will be a regular table
● But you can manipulate periods with this syntax:
○ DELETE FROM <table_name>
FOR PORTION OF <period_name>
FROM <date1> TO <date2>
○ UPDATE <table_name>
FOR PORTION OF <period_name>
FROM <date1> TO <date2>
System-Versioned Tables
Bitemporal Tables
● Combine the syntaxes of sysver and application-period tables to
obtain a bitemporal table
● This table will store two separate pairs of timestamps:
○ When the row was physically inserted/deleted/updated
○ The boundaries of the represented period
System-Versioned Tables
Example:
● 2018/01/10 - Customer registers, she lives in Glasgow
● 2022/05/01 - Customer relocates to Inverness
● 2022/06/01 - Customer orders a product
● 2022/06/02 - Customer changes her address in her profile, and
correctly dates the change to 2022/05/01
Customer never received the parcel. Our temporal table allows us
to track this chronology and point out that
the customer communicated her address change too late.
System-Versioned Tables
A note of MindsDB
● If you built Temporal Tables, you have something similar to
(but slightly more complex than) a time series
● Do you know that you can query future data?
System-Versioned Tables
● MindsDB is an AI-based virtual database
● It connects to a huge range of external data sources,
including MariaDB
● It accepts SQL queries
● The results are calculated using Machine Learning algorithms
System-Versioned Tables
So, for example, if you have data about your sales in the last 2
years, you can obtain a forecast about the next 6 months
Vettabase is MindsDB partner.
We maintain their MySQL integration.
System-Versioned Tables
Ad

More Related Content

Similar to Webinar - MariaDB Temporal Tables: a demonstration (20)

A time Travel with temporal tables
A time Travel with temporal tablesA time Travel with temporal tables
A time Travel with temporal tables
Leonel Abreu
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet pratap Singh
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet Singh
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
MSDEVMTL
 
Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...
Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...
Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...
Safe Software
 
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Lucas Jellema
 
Redefining tables online without surprises
Redefining tables online without surprisesRedefining tables online without surprises
Redefining tables online without surprises
Nelson Calero
 
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
HostedbyConfluent
 
MariaDB Temporal Tables
MariaDB Temporal TablesMariaDB Temporal Tables
MariaDB Temporal Tables
Federico Razzoli
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's New
dpcobb
 
Back to the future - Temporal Table in SQL Server 2016
Back to the future - Temporal Table in SQL Server 2016Back to the future - Temporal Table in SQL Server 2016
Back to the future - Temporal Table in SQL Server 2016
Stéphane Fréchette
 
Liquibase case study
Liquibase case studyLiquibase case study
Liquibase case study
Vivek Dhayalan
 
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB plc
 
Teradata Tutorial for Beginners
Teradata Tutorial for BeginnersTeradata Tutorial for Beginners
Teradata Tutorial for Beginners
rajkamaltibacademy
 
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres OpenKeith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
PostgresOpen
 
Oracle data capture c dc
Oracle data capture c dcOracle data capture c dc
Oracle data capture c dc
Amit Sharma
 
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)PHP Detroit -- MySQL 8 A New Beginning (updated presentation)
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)
Dave Stokes
 
MODULE 5.pptx
MODULE 5.pptxMODULE 5.pptx
MODULE 5.pptx
lathass5
 
Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?
Huy Nguyen
 
Technical Presentation - TimeWIzard
Technical Presentation - TimeWIzardTechnical Presentation - TimeWIzard
Technical Presentation - TimeWIzard
Praveen Kumar Peddi
 
A time Travel with temporal tables
A time Travel with temporal tablesA time Travel with temporal tables
A time Travel with temporal tables
Leonel Abreu
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet Singh
 
SQL Server 2016 novelties
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
MSDEVMTL
 
Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...
Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...
Managing Changing Data with FME: Part 2 – Flexible Approaches to Tracking Cha...
Safe Software
 
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas...
Lucas Jellema
 
Redefining tables online without surprises
Redefining tables online without surprisesRedefining tables online without surprises
Redefining tables online without surprises
Nelson Calero
 
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022
HostedbyConfluent
 
Sql 2016 - What's New
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's New
dpcobb
 
Back to the future - Temporal Table in SQL Server 2016
Back to the future - Temporal Table in SQL Server 2016Back to the future - Temporal Table in SQL Server 2016
Back to the future - Temporal Table in SQL Server 2016
Stéphane Fréchette
 
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB plc
 
Teradata Tutorial for Beginners
Teradata Tutorial for BeginnersTeradata Tutorial for Beginners
Teradata Tutorial for Beginners
rajkamaltibacademy
 
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres OpenKeith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open
PostgresOpen
 
Oracle data capture c dc
Oracle data capture c dcOracle data capture c dc
Oracle data capture c dc
Amit Sharma
 
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)PHP Detroit -- MySQL 8 A New Beginning (updated presentation)
PHP Detroit -- MySQL 8 A New Beginning (updated presentation)
Dave Stokes
 
MODULE 5.pptx
MODULE 5.pptxMODULE 5.pptx
MODULE 5.pptx
lathass5
 
Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?
Huy Nguyen
 
Technical Presentation - TimeWIzard
Technical Presentation - TimeWIzardTechnical Presentation - TimeWIzard
Technical Presentation - TimeWIzard
Praveen Kumar Peddi
 

More from Federico Razzoli (20)

MariaDB Data Protection: Backup Strategies for the Real World
MariaDB Data Protection: Backup Strategies for the Real WorldMariaDB Data Protection: Backup Strategies for the Real World
MariaDB Data Protection: Backup Strategies for the Real World
Federico Razzoli
 
MariaDB/MySQL_: Developing Scalable Applications
MariaDB/MySQL_: Developing Scalable ApplicationsMariaDB/MySQL_: Developing Scalable Applications
MariaDB/MySQL_: Developing Scalable Applications
Federico Razzoli
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
High-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deploymentHigh-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deployment
Federico Razzoli
 
Webinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDBWebinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDB
Federico Razzoli
 
MariaDB Security Best Practices
MariaDB Security Best PracticesMariaDB Security Best Practices
MariaDB Security Best Practices
Federico Razzoli
 
A first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli
 
MariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Federico Razzoli
 
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Federico Razzoli
 
MariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAs
Federico Razzoli
 
Recent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy lifeRecent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy life
Federico Razzoli
 
Advanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdfAdvanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdf
Federico Razzoli
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with Ansible
Federico Razzoli
 
Creating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDBCreating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDB
Federico Razzoli
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
Federico Razzoli
 
Playing with the CONNECT storage engine
Playing with the CONNECT storage enginePlaying with the CONNECT storage engine
Playing with the CONNECT storage engine
Federico Razzoli
 
Database Design most common pitfalls
Database Design most common pitfallsDatabase Design most common pitfalls
Database Design most common pitfalls
Federico Razzoli
 
MySQL and MariaDB Backups
MySQL and MariaDB BackupsMySQL and MariaDB Backups
MySQL and MariaDB Backups
Federico Razzoli
 
JSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB DatabasesJSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB Databases
Federico Razzoli
 
How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2
Federico Razzoli
 
MariaDB Data Protection: Backup Strategies for the Real World
MariaDB Data Protection: Backup Strategies for the Real WorldMariaDB Data Protection: Backup Strategies for the Real World
MariaDB Data Protection: Backup Strategies for the Real World
Federico Razzoli
 
MariaDB/MySQL_: Developing Scalable Applications
MariaDB/MySQL_: Developing Scalable ApplicationsMariaDB/MySQL_: Developing Scalable Applications
MariaDB/MySQL_: Developing Scalable Applications
Federico Razzoli
 
Webinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data WarehouseWebinar: Designing a schema for a Data Warehouse
Webinar: Designing a schema for a Data Warehouse
Federico Razzoli
 
High-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deploymentHigh-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deployment
Federico Razzoli
 
Webinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDBWebinar - Unleash AI power with MySQL and MindsDB
Webinar - Unleash AI power with MySQL and MindsDB
Federico Razzoli
 
MariaDB Security Best Practices
MariaDB Security Best PracticesMariaDB Security Best Practices
MariaDB Security Best Practices
Federico Razzoli
 
A first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli
 
MariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Federico Razzoli
 
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11
Federico Razzoli
 
MariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAs
Federico Razzoli
 
Recent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy lifeRecent MariaDB features to learn for a happy life
Recent MariaDB features to learn for a happy life
Federico Razzoli
 
Advanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdfAdvanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdf
Federico Razzoli
 
Automate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with Ansible
Federico Razzoli
 
Creating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDBCreating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDB
Federico Razzoli
 
MariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
Federico Razzoli
 
Playing with the CONNECT storage engine
Playing with the CONNECT storage enginePlaying with the CONNECT storage engine
Playing with the CONNECT storage engine
Federico Razzoli
 
Database Design most common pitfalls
Database Design most common pitfallsDatabase Design most common pitfalls
Database Design most common pitfalls
Federico Razzoli
 
JSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB DatabasesJSON in MySQL and MariaDB Databases
JSON in MySQL and MariaDB Databases
Federico Razzoli
 
How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2How MySQL can boost (or kill) your application v2
How MySQL can boost (or kill) your application v2
Federico Razzoli
 
Ad

Recently uploaded (20)

Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
How to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud PerformanceHow to Optimize Your AWS Environment for Improved Cloud Performance
How to Optimize Your AWS Environment for Improved Cloud Performance
ThousandEyes
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Maxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINKMaxon CINEMA 4D 2025 Crack FREE Download LINK
Maxon CINEMA 4D 2025 Crack FREE Download LINK
younisnoman75
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Ad

Webinar - MariaDB Temporal Tables: a demonstration

  • 2. ● Why track data changes? ● System-versioned tables ● Application-period tables ● Bitemporal tables ● A word on MindsDB Agenda
  • 4. ● Auditing ● Travel back in time ● Compare today situation with 6 months ago ● Statistics on data changes ● Find correlations ● History of an entity ● Debug Tracking Data Changes: WHY?
  • 5. ● There are many ways to track data changes. ● Most commonly, they involve having a consumer that reads the binary log and send changes to other technologies, like Kafka. ● Great for analytics, message queues, auditing. ● But the changes are: ○ Replicated asynchronously ○ Not available to the application Tracking Data Changes
  • 6. In-Database data changes tracking methods: ● Logging row versions into a table ● Logging each value change into a table ● Temporal tables Tracking Data Changes
  • 7. Advantages of Temporal Tables: ● The versioning logic is transparent ● Rotation can be automated ● Faster and more scalable Tracking Data Changes
  • 9. Existing implementations (I know about): ● Oracle 11g (2007) ● IBM Db2 (2012) ● SQL Server (2016) ● Snowflake Temporal Tables Overview
  • 10. Existing implementations (I know about): ● PostgreSQL has a temporal tables extension ● CockroachDB ● CruxDB ● HBase (kind of) Temporal Tables Overview
  • 11. ● MariaDB 10.3: system-versioned tables ● MariaDB 10.4: application period tables A table can implement both. It's called a bitemporal table. Temporal Tables Overview
  • 12. ● Rows are versioned ● Every row has 2 timestamps, the start & end of that version validity ● INSERT, UPDATE, DELETE modify those timestamps in a transparent way ● Plain SQL SELECTs only return current data ● Using temporal syntax, we can query past data System-Versioned
  • 13. ● Works best to describe events with a start and an end ● Especially when some events cannot overlap ● Timestamps are written explicitly by the application ● But UPDATE and DELETE can automagically shrink or split periods ● Apart from this, they are regular tables that you use with normal SQL syntax Application-Period Tables
  • 14. ● Not understanding this damages projects. ● If you work for a vendor, whether you want to say it or not, feel free to correct any mistake I might make Temporal Tables Overview
  • 16. ● Create a sysver table: CREATE TABLE tbl_name ( … valid_since TIMESTAMP(6) GENERATED ALWAYS AS ROW START INVISIBLE, valid_until TIMESTAMP(6) GENERATED ALWAYS AS ROW END INVISIBLE, PERIOD FOR SYSTEM_TIME(valid_since, valid_until) ) WITH SYSTEM VERSIONING ; System-Versioned Tables
  • 17. Best practices: ● You could omit the column names, but then you won't be able to use them in queries ● You can use different names, but I recommend you always use the same names ● You could use visible columns, but most of the times you don't want to see them System-Versioned Tables
  • 18. ● An existing table can be made sysver: ALTER TABLE tbl_name ADD COLUMN valid_since TIMESTAMP(6) GENERATED ALWAYS AS ROW START INVISIBLE, ADD COLUMN valid_until TIMESTAMP(6) GENERATED ALWAYS AS ROW END INVISIBLE, ADD PERIOD FOR SYSTEM_TIME(valid_since, valid_until), ADD SYSTEM VERSIONING ; System-Versioned Tables
  • 19. Best practices: ● Making one, multiple, or even all tables sysver is not a risky operation - but you never know ● You can do this on a new replica that is used by analysts or programs that read historical data ● For such replicas it's usually ok not to use an LTS version ● Once you're confident enough, you can make the change on the master System-Versioned Tables
  • 20. ● In both cases (new or existing table), it's practical to create one or more separate partitions for historical data: ALTER TABLE tbl_name PARTITION BY SYSTEM_TIME ( PARTITION p_history1 HISTORY, … , PARTITION p_current CURRENT ) ; System-Versioned Tables
  • 21. How to delete history: ● Remove history before a point in time: DELETE HISTORY FROM tbl_name BEFORE SYSTEM_TIME '2020-01-01 00:00:00'; ● Remove whole history: DELETE HISTORY FROM tbl_name; ● Remove history and make the table non-sysver: ALTER TABLE t DROP SYSTEM VERSIONING; ● Remove history and current data: TRUNCATE TABLE tbl_name; System-Versioned Tables
  • 22. ● GDPR and possibly some other regulations guarantee the Right To Be Forgotten (RTBF) ● This means that we can't keep the whole history of columns that contain Personal Identifiable Information (PII) ● To exclude these columns from a table history: CREATE TABLE user ( … email VARCHAR(100) NOT NULL WITHOUT SYSTEM VERSIONING, … ) WITH SYSTEM VERSIONING ; Right To Be Forgotten
  • 24. ● Creating an Application-Period table: CREATE OR REPLACE TABLE reservation ( uuid UUID DEFAULT UUID(), bungalow_name VARCHAR(100) NOT NULL, client_name VARCHAR(100) NOT NULL, start_date DATE, end_date DATE, PRIMARY KEY (uuid, start_date), PERIOD FOR reservation (start_date, end_date) ); System-Versioned Tables
  • 25. ● If you don't use periods explicitly, it will be a regular table ● But you can manipulate periods with this syntax: ○ DELETE FROM <table_name> FOR PORTION OF <period_name> FROM <date1> TO <date2> ○ UPDATE <table_name> FOR PORTION OF <period_name> FROM <date1> TO <date2> System-Versioned Tables
  • 27. ● Combine the syntaxes of sysver and application-period tables to obtain a bitemporal table ● This table will store two separate pairs of timestamps: ○ When the row was physically inserted/deleted/updated ○ The boundaries of the represented period System-Versioned Tables
  • 28. Example: ● 2018/01/10 - Customer registers, she lives in Glasgow ● 2022/05/01 - Customer relocates to Inverness ● 2022/06/01 - Customer orders a product ● 2022/06/02 - Customer changes her address in her profile, and correctly dates the change to 2022/05/01 Customer never received the parcel. Our temporal table allows us to track this chronology and point out that the customer communicated her address change too late. System-Versioned Tables
  • 29. A note of MindsDB
  • 30. ● If you built Temporal Tables, you have something similar to (but slightly more complex than) a time series ● Do you know that you can query future data? System-Versioned Tables
  • 31. ● MindsDB is an AI-based virtual database ● It connects to a huge range of external data sources, including MariaDB ● It accepts SQL queries ● The results are calculated using Machine Learning algorithms System-Versioned Tables
  • 32. So, for example, if you have data about your sales in the last 2 years, you can obtain a forecast about the next 6 months Vettabase is MindsDB partner. We maintain their MySQL integration. System-Versioned Tables