我(将)有数十万条记录,我插入一次,永远不会更新许多行包含相同的previousId。我可以保证一个开始/结束索引吗?我在 table_c 中使用事务插入 X 行,并将开始和结束(或开始和长度或结束和长度)写入 table_b,而不是让每一行都保存 table_b ID?
如果是这样,我该如何编写 SQL?我刚在想
begin transaction
insert XYZ rows into tbl_c
c_rowId = last_insert_rowid
insert table_b with data + start=c_rowId-lengthOfInsert, end=c_rowId;
commit; end transaction
这会按我的预期工作吗?