go-mysql-server
go-mysql-server copied to clipboard
In-memory tables can't verify the uniqueness of a virtual generated column
Secondary indexes on in-memory tables are currently not very efficient: they're stored as a sorted list of rows, and don't get re-sorted until the end of a batch table edit operation.
This makes detecting duplicate values in a unique virtual column slow and nontrivial.
In order to do this, we would need to either:
- Scan every row of the table for each insert operation, computing the virtual column for each row.
- Use a data structure for indexes that can be updated in place
I added disabled tests for this in https://github.com/dolthub/go-mysql-server/pull/2641