go-mysql-server icon indicating copy to clipboard operation
go-mysql-server copied to clipboard

In-memory tables can't verify the uniqueness of a virtual generated column

Open nicktobey opened this issue 5 months ago • 0 comments

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

nicktobey avatar Aug 27 '24 22:08 nicktobey