Webinar - MariaDB Temporal Tables: a demonstration

Federico Razzoli
Federico RazzoliVettabase Founder à Vettabase
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
1 sur 32

Recommandé

MariaDB Temporal Tables par
MariaDB Temporal TablesMariaDB Temporal Tables
MariaDB Temporal TablesFederico Razzoli
408 vues39 diapositives
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa par
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaCuneyt Goksu
298 vues29 diapositives
sql_server_2016_history_tables par
sql_server_2016_history_tablessql_server_2016_history_tables
sql_server_2016_history_tablesarthurjosemberg
266 vues28 diapositives
Time Travelling With DB2 10 For zOS par
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSLaura Hood
499 vues34 diapositives
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA par
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAATemporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAACuneyt Goksu
3K vues39 diapositives
CDC patterns in Apache Kafka® par
CDC patterns in Apache Kafka®CDC patterns in Apache Kafka®
CDC patterns in Apache Kafka®confluent
715 vues21 diapositives

Contenu connexe

Similaire à Webinar - MariaDB Temporal Tables: a demonstration

A time Travel with temporal tables par
A time Travel with temporal tablesA time Travel with temporal tables
A time Travel with temporal tablesLeonel Abreu
187 vues17 diapositives
Sql server 2016 new features par
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new featuresAjeet Singh
4.2K vues14 diapositives
Sql server 2016 new features par
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new featuresAjeet pratap Singh
223 vues14 diapositives
SQL Server 2016 novelties par
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 noveltiesMSDEVMTL
2.9K vues85 diapositives
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas... par
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
1.8K vues50 diapositives
Redefining tables online without surprises par
Redefining tables online without surprisesRedefining tables online without surprises
Redefining tables online without surprisesNelson Calero
4.7K vues40 diapositives

Similaire à Webinar - MariaDB Temporal Tables: a demonstration(20)

A time Travel with temporal tables par Leonel Abreu
A time Travel with temporal tablesA time Travel with temporal tables
A time Travel with temporal tables
Leonel Abreu187 vues
Sql server 2016 new features par Ajeet Singh
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
Ajeet Singh4.2K vues
SQL Server 2016 novelties par MSDEVMTL
SQL Server 2016 noveltiesSQL Server 2016 novelties
SQL Server 2016 novelties
MSDEVMTL2.9K vues
Time is of the essence - The Fourth Dimension in Oracle Database 12c (on Flas... par Lucas Jellema
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 Jellema1.8K vues
Redefining tables online without surprises par Nelson Calero
Redefining tables online without surprisesRedefining tables online without surprises
Redefining tables online without surprises
Nelson Calero4.7K vues
SQL Extensions to Support Streaming Data With Fabian Hueske | Current 2022 par HostedbyConfluent
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
Sql 2016 - What's New par dpcobb
Sql 2016 - What's NewSql 2016 - What's New
Sql 2016 - What's New
dpcobb822 vues
Back to the future - Temporal Table in SQL Server 2016 par Stéphane Fréchette
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
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität par MariaDB plc
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 plc257 vues
Keith Fiske - When PostgreSQL Can't, You Can @ Postgres Open par PostgresOpen
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
PostgresOpen1.9K vues
Oracle data capture c dc par Amit Sharma
Oracle data capture c dcOracle data capture c dc
Oracle data capture c dc
Amit Sharma803 vues
PHP Detroit -- MySQL 8 A New Beginning (updated presentation) par Dave Stokes
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 Stokes294 vues
Why PostgreSQL for Analytics Infrastructure (DW)? par Huy Nguyen
Why PostgreSQL for Analytics Infrastructure (DW)?Why PostgreSQL for Analytics Infrastructure (DW)?
Why PostgreSQL for Analytics Infrastructure (DW)?
Huy Nguyen2.7K vues

Plus de Federico Razzoli

A first look at MariaDB 11.x features and ideas on how to use them par
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 themFederico Razzoli
46 vues36 diapositives
MariaDB stored procedures and why they should be improved par
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 improvedFederico Razzoli
8 vues32 diapositives
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11 par
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.11Federico Razzoli
58 vues36 diapositives
MariaDB 10.11 key features overview for DBAs par
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAsFederico Razzoli
144 vues38 diapositives
Recent MariaDB features to learn for a happy life par
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 lifeFederico Razzoli
31 vues38 diapositives
Advanced MariaDB features that developers love.pdf par
Advanced MariaDB features that developers love.pdfAdvanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdfFederico Razzoli
101 vues38 diapositives

Plus de Federico Razzoli(18)

A first look at MariaDB 11.x features and ideas on how to use them par Federico Razzoli
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
MariaDB stored procedures and why they should be improved par Federico Razzoli
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
Webinar - Key Reasons to Upgrade to MySQL 8.0 or MariaDB 10.11 par Federico Razzoli
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
MariaDB 10.11 key features overview for DBAs par Federico Razzoli
MariaDB 10.11 key features overview for DBAsMariaDB 10.11 key features overview for DBAs
MariaDB 10.11 key features overview for DBAs
Federico Razzoli144 vues
Recent MariaDB features to learn for a happy life par Federico Razzoli
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
Advanced MariaDB features that developers love.pdf par Federico Razzoli
Advanced MariaDB features that developers love.pdfAdvanced MariaDB features that developers love.pdf
Advanced MariaDB features that developers love.pdf
Federico Razzoli101 vues
Automate MariaDB Galera clusters deployments with Ansible par Federico Razzoli
Automate MariaDB Galera clusters deployments with AnsibleAutomate MariaDB Galera clusters deployments with Ansible
Automate MariaDB Galera clusters deployments with Ansible
Federico Razzoli489 vues
Creating Vagrant development machines with MariaDB par Federico Razzoli
Creating Vagrant development machines with MariaDBCreating Vagrant development machines with MariaDB
Creating Vagrant development machines with MariaDB
MariaDB, MySQL and Ansible: automating database infrastructures par Federico Razzoli
MariaDB, MySQL and Ansible: automating database infrastructuresMariaDB, MySQL and Ansible: automating database infrastructures
MariaDB, MySQL and Ansible: automating database infrastructures
Federico Razzoli175 vues
How MySQL can boost (or kill) your application v2 par Federico Razzoli
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 Razzoli124 vues
MySQL Transaction Isolation Levels (lightning talk) par Federico Razzoli
MySQL Transaction Isolation Levels (lightning talk)MySQL Transaction Isolation Levels (lightning talk)
MySQL Transaction Isolation Levels (lightning talk)
Federico Razzoli119 vues
Cassandra sharding and consistency (lightning talk) par Federico Razzoli
Cassandra sharding and consistency (lightning talk)Cassandra sharding and consistency (lightning talk)
Cassandra sharding and consistency (lightning talk)
Federico Razzoli2.3K vues
How MySQL can boost (or kill) your application par Federico Razzoli
How MySQL can boost (or kill) your applicationHow MySQL can boost (or kill) your application
How MySQL can boost (or kill) your application
Federico Razzoli341 vues

Dernier

predicting-m3-devopsconMunich-2023-v2.pptx par
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptxTier1 app
9 vues33 diapositives
What is API par
What is APIWhat is API
What is APIartembondar5
10 vues15 diapositives
Myths and Facts About Hospice Care: Busting Common Misconceptions par
Myths and Facts About Hospice Care: Busting Common MisconceptionsMyths and Facts About Hospice Care: Busting Common Misconceptions
Myths and Facts About Hospice Care: Busting Common MisconceptionsCare Coordinations
7 vues1 diapositive
ShortStory_qlora.pptx par
ShortStory_qlora.pptxShortStory_qlora.pptx
ShortStory_qlora.pptxpranathikrishna22
5 vues10 diapositives
MS PowerPoint.pptx par
MS PowerPoint.pptxMS PowerPoint.pptx
MS PowerPoint.pptxLitty Sylus
7 vues14 diapositives
Fleet Management Software in India par
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India Fleetable
12 vues1 diapositive

Dernier(20)

predicting-m3-devopsconMunich-2023-v2.pptx par Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptxpredicting-m3-devopsconMunich-2023-v2.pptx
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app9 vues
Myths and Facts About Hospice Care: Busting Common Misconceptions par Care Coordinations
Myths and Facts About Hospice Care: Busting Common MisconceptionsMyths and Facts About Hospice Care: Busting Common Misconceptions
Myths and Facts About Hospice Care: Busting Common Misconceptions
Fleet Management Software in India par Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable12 vues
Generic or specific? Making sensible software design decisions par Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation par HCLSoftware
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook AutomationDRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
DRYiCE™ iAutomate: AI-enhanced Intelligent Runbook Automation
HCLSoftware6 vues
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx par animuscrm
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
2023-November-Schneider Electric-Meetup-BCN Admin Group.pptx
animuscrm15 vues

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