When updating a row in a system-versioned table and updating a column's value with the exact current value, a new historical row is written, that has the same ROW_START value as well as the same value for any other column as the previous one, while a ON UPDATE CURRENT_TIMESTAMP() column is not updated on the current row.
I also experienced that issue to not exist when updating a ENUM column with the exact current value, while existing when updating a INT column with the exact current value. However, in the example below the columns all behave the same.
CREATE TABLE Foobar (
|
id INT(11) NOT NULL,
|
a INT(11) NOT NULL,
|
b ENUM('foo', 'bar') NOT NULL,
|
c VARCHAR(255) NOT NULL,
|
ts DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP() ON UPDATE CURRENT_TIMESTAMP(),
|
PRIMARY KEY (id)
|
) WITH SYSTEM VERSIONING;
|
INSERT INTO Foobar (id, a, b, c) VALUES (1, 1, 'foo', 'hello');
|
-- 1 row
|
SELECT *, ROW_START, ROW_END FROM Foobar FOR SYSTEM_TIME ALL WHERE id = 1;
|
UPDATE Foobar SET b = 'foo' WHERE id = 1;
|
-- 2 rows with the exact same values except for ROW_END
|
SELECT *, ROW_START, ROW_END FROM Foobar FOR SYSTEM_TIME ALL WHERE id = 1;
|
UPDATE Foobar SET a = 1 WHERE id = 1;
|
-- 3 rows with the exact same values except for ROW_END
|
SELECT *, ROW_START, ROW_END FROM Foobar FOR SYSTEM_TIME ALL WHERE id = 1;
|
SELECT *, ROW_START, ROW_END FROM Foobar FOR SYSTEM_TIME AS OF '<row_start_value>' WHERE id = 1 will also return 3 rows, while I would expect only 1.
I would expect that a historical row is only written when data in the row really change, just like a ON UPDATE column behaves.
Transition |
Time In Source Status |
Execution Times |
Open |
|
Closed |
|
3h 49m
|
1
|
{"report":{"fcp":1175.3999996185303,"ttfb":287.69999980926514,"pageVisibility":"visible","entityId":103701,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"0e622c6b-82ab-4b1b-9c40-eb7b652ac150","navigationType":0,"readyForUser":1257.3999996185303,"redirectCount":0,"resourceLoadedEnd":1702.5,"resourceLoadedStart":293.19999980926514,"resourceTiming":[{"duration":390.80000019073486,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":293.19999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":293.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":684,"responseStart":0,"secureConnectionStart":0},{"duration":390.79999923706055,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":293.5,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":293.5,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":684.2999992370605,"responseStart":0,"secureConnectionStart":0},{"duration":411.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":293.69999980926514,"connectEnd":293.69999980926514,"connectStart":293.69999980926514,"domainLookupEnd":293.69999980926514,"domainLookupStart":293.69999980926514,"fetchStart":293.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":293.69999980926514,"responseEnd":704.8999996185303,"responseStart":704.8999996185303,"secureConnectionStart":293.69999980926514},{"duration":451.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":293.8999996185303,"connectEnd":293.8999996185303,"connectStart":293.8999996185303,"domainLookupEnd":293.8999996185303,"domainLookupStart":293.8999996185303,"fetchStart":293.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":293.8999996185303,"responseEnd":745.0999994277954,"responseStart":745.0999994277954,"secureConnectionStart":293.8999996185303},{"duration":454.9000005722046,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":294.0999994277954,"connectEnd":294.0999994277954,"connectStart":294.0999994277954,"domainLookupEnd":294.0999994277954,"domainLookupStart":294.0999994277954,"fetchStart":294.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":294.0999994277954,"responseEnd":749,"responseStart":749,"secureConnectionStart":294.0999994277954},{"duration":455.1000003814697,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":294.29999923706055,"connectEnd":294.29999923706055,"connectStart":294.29999923706055,"domainLookupEnd":294.29999923706055,"domainLookupStart":294.29999923706055,"fetchStart":294.29999923706055,"redirectEnd":0,"redirectStart":0,"requestStart":294.29999923706055,"responseEnd":749.3999996185303,"responseStart":749.3999996185303,"secureConnectionStart":294.29999923706055},{"duration":455.19999980926514,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":294.5999994277954,"connectEnd":294.5999994277954,"connectStart":294.5999994277954,"domainLookupEnd":294.5999994277954,"domainLookupStart":294.5999994277954,"fetchStart":294.5999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":294.5999994277954,"responseEnd":749.7999992370605,"responseStart":749.7999992370605,"secureConnectionStart":294.5999994277954},{"duration":553.8000001907349,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":294.69999980926514,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":294.69999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":848.5,"responseStart":0,"secureConnectionStart":0},{"duration":455.30000019073486,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":294.8999996185303,"connectEnd":294.8999996185303,"connectStart":294.8999996185303,"domainLookupEnd":294.8999996185303,"domainLookupStart":294.8999996185303,"fetchStart":294.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":294.8999996185303,"responseEnd":750.1999998092651,"responseStart":750.1999998092651,"secureConnectionStart":294.8999996185303},{"duration":553.5,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":295.0999994277954,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":295.0999994277954,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":848.5999994277954,"responseStart":0,"secureConnectionStart":0},{"duration":455.5999994277954,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":295.19999980926514,"connectEnd":295.19999980926514,"connectStart":295.19999980926514,"domainLookupEnd":295.19999980926514,"domainLookupStart":295.19999980926514,"fetchStart":295.19999980926514,"redirectEnd":0,"redirectStart":0,"requestStart":295.19999980926514,"responseEnd":750.7999992370605,"responseStart":750.7999992370605,"secureConnectionStart":295.19999980926514},{"duration":1398.8999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":300.8999996185303,"connectEnd":300.8999996185303,"connectStart":300.8999996185303,"domainLookupEnd":300.8999996185303,"domainLookupStart":300.8999996185303,"fetchStart":300.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":300.8999996185303,"responseEnd":1699.7999992370605,"responseStart":1699.7999992370605,"secureConnectionStart":300.8999996185303},{"duration":1399.3999996185303,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":300.8999996185303,"connectEnd":300.8999996185303,"connectStart":300.8999996185303,"domainLookupEnd":300.8999996185303,"domainLookupStart":300.8999996185303,"fetchStart":300.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":300.8999996185303,"responseEnd":1700.2999992370605,"responseStart":1700.2999992370605,"secureConnectionStart":300.8999996185303},{"duration":243.39999961853027,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":860.8999996185303,"connectEnd":860.8999996185303,"connectStart":860.8999996185303,"domainLookupEnd":860.8999996185303,"domainLookupStart":860.8999996185303,"fetchStart":860.8999996185303,"redirectEnd":0,"redirectStart":0,"requestStart":860.8999996185303,"responseEnd":1104.2999992370605,"responseStart":1104.2999992370605,"secureConnectionStart":860.8999996185303},{"duration":574.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/e65b778d185daf5aee24936755b43da6/_/download/contextbatch/js/browser-metrics-plugin.contrib,-_super,-atl.general/batch.js?agile_global_admin_condition=true&jag=true&slack-enabled=true","startTime":1128,"connectEnd":1128,"connectStart":1128,"domainLookupEnd":1128,"domainLookupStart":1128,"fetchStart":1128,"redirectEnd":0,"redirectStart":0,"requestStart":1128,"responseEnd":1702.5,"responseStart":1702.5,"secureConnectionStart":1128},{"duration":602.6999998092651,"initiatorType":"script","name":"https://www.google-analytics.com/analytics.js","startTime":1169,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":1169,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":1771.6999998092651,"responseStart":0,"secureConnectionStart":0}],"fetchStart":1,"domainLookupStart":1,"domainLookupEnd":1,"connectStart":1,"connectEnd":1,"requestStart":124,"responseStart":288,"responseEnd":294,"domLoading":292,"domInteractive":1725,"domContentLoadedEventStart":1725,"domContentLoadedEventEnd":1767,"domComplete":2298,"loadEventStart":2298,"loadEventEnd":2299,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1706.5},{"name":"bigPipe.sidebar-id.end","time":1707.2999992370605},{"name":"bigPipe.activity-panel-pipe-id.start","time":1707.3999996185303},{"name":"bigPipe.activity-panel-pipe-id.end","time":1708.1999998092651},{"name":"activityTabFullyLoaded","time":1780.6999998092651}],"measures":[],"correlationId":"451909fd6a850a","effectiveType":"4g","downlink":9.4,"rtt":0,"serverDuration":100,"dbReadsTimeInMs":15,"dbConnsTimeInMs":23,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}