Вход на сайт

Просмотр новости

Найдите то, что Вас интересует

Inserting in Two Tables in a Single Round-Trip with JSON Duality Views in MySQL 9.7

Дата публикации: 04-06-2026 14:17:32

A few months ago, I was asking myself how to insert in two tables in a single round-trip to the database.  I wanted to do that to optimize a process.  My optimization involved splitting a table in two, which would need inserting in two tables atomically.  The downside was changing an auto-commit INSERT to a transaction with two inserts, which was changing the shape of the workload
Inserting in Two Tables in a Single Round-Trip with JSON Duality Views in MySQL 9.7 appeared first on MariaDB.org


Основное содержимое страницы с новостью.

A few months ago, I was asking myself how to insert in two tables in a single round-trip to the database.  I wanted to do that to optimize a process.  My optimization involved splitting a table in two, which would need inserting in two tables atomically.  The downside was changing an auto-commit INSERT to a transaction with two inserts, which was changing the shape of the workload from a single round-trip to the database to four: BEGIN, INSERT1, INSERT2, and COMMIT.  I had no satisfying solution to that, I now have one: JSON Duality Views in MySQL 9.7.

I found that solution in Marcelo Altmann post JSON Duality Views in MySQL 9.7 — What you need to know.  I will let you read Marcelo's post for the details.

The unsatisfying solutions I had were Stored Procedures and Triggers.  Both are deploying application logic in the database, and this is not a line I cross lightly.  I was thinking of a new INSERT syntax for solving this, but it was non-trivial (UPDATE and DELETE are possible on two tables).  Now, I know of a better way in MySQL 9.7, and it makes this new version more appealing to me (before knowing this, I found both MySQL 8.4 and 9.7 very ordinary and not worth the upgrade, this now changed).

Схожие новости

#Наименование новостиТональностьИнформативностьДата публикации
1Understanding InnoDB Tablespace Duplicate Check (MySQL Startup with Many Tables)04.7619-11-2024
2InnoDB Tablespace Duplicate Check Threads (and EBS Volumes for MySQL Startup with Many Tables)07.4103-12-2024
3Inside MySQL 9.7 LTS Features011.0615-07-2026
4Long and Silent / Stressful MySQL Startup with Many Tables05.1911-11-2024
5Do not uselessly grant CREATE and ALTER TABLE09.1120-06-2026
6Running DuckDB as a MySQL 9.7 storage engine012.210-07-2026
7Replicating from InnoDB into a DuckDB storage engine05.5113-08-2026
8MySQL 8.0.17 GTID Crash Safety Improvement09.2104-08-2026
9DuckDB Speed on MySQL with dbtrail, Without a New Storage Engine010.526-08-2026
10Simple tool to build MariaDB commits for performance-change analysis06.9818-06-2026

Классификация: . Схожих патентов: 0. Схожих новостей: 10. Тональность: 0. Информативность: 5.99. Источник: mariadb.org.