Verify query results across a schema changeΒΆ
MatrixOne has an internal session plan cache. This exercise checks that repeated queries keep returning the right data after a table change. It does not measure cache hits; a fast result alone is not evidence of one.
CREATE DATABASE cookbook_plan;
CREATE TABLE cookbook_plan.orders(id INT PRIMARY KEY, amount INT);
INSERT INTO cookbook_plan.orders VALUES(1,10);
SELECT amount FROM cookbook_plan.orders WHERE id=1;
SELECT amount FROM cookbook_plan.orders WHERE id=1;
ALTER TABLE cookbook_plan.orders ADD COLUMN reviewed INT DEFAULT 0;
UPDATE cookbook_plan.orders SET amount=15,reviewed=1 WHERE id=1;
SELECT amount FROM cookbook_plan.orders WHERE id=1;
SELECT reviewed FROM cookbook_plan.orders WHERE id=1;
DROP DATABASE cookbook_plan;
The first two queries return 10; after the update, the same SQL returns 15, and the query using the added column returns 1. The frontend cache tests cover invalidation rules that SQL output alone cannot prove. See the v4.1.0 source test.