APPENDIX · P4 · DUBs · FOR SLIDE 15
← Back to Slide 15
P4. One more recap: FINAL vs. raw strings
SYSTEM STOP MERGES match_results;
INSERT INTO match_results
VALUES (777, 1042, 12, 1);
SELECT count() FROM match_results;
SELECT count(), sum(kills)
FROM match_results FINAL;
SYSTEM START MERGES match_results;
What the result should be
4 // без FINAL: дубль виден
3 20 // FINAL: как до повтора
Without FINAL
FINAL
The same version
Line 4: The repetition remains in a separate section until it merges with the rest.
3 rows and 20 kills: duplicates based on the ORDER BY clause were discarded during the read.
Of the lines with the same version, the most recently inserted one remains; in this case, they are identical.
STOP MERGES — for demonstration purposes only. The query should not depend on whether a merge occurred: FINAL or argMax provide the correct answer.