我希望 Laurion Burchall 能读到这个:-)
我需要尽快插入一百万条小记录。
现在我处于一个非常紧张的循环中,对于每条记录,我
a) start a transaction (JetBeginTransaction)
b) prepare an update (JetPrepareUpdate)
c) add the row (JetSetColumns)
d) commit the transaction (JetCommitTransaction)
现在,在这个过程中,我在一个处理器上处于一个紧密的循环中。目标机器有多个 CPU、大磁盘和大量可用 RAM。
我想知道如何获得更好的性能。
就交易而言,我做了一些实验,如果我在一个交易中放入太多数据,就会出现错误回来的麻烦。我想更好地了解那里发生了什么 - 我是否有错误,或者交易的大小是否有上限,如果有上限,我可以扩大上限吗?我只是对此进行调查,因为我猜测事务使 ESE 能够在 RAM 中进行更多缓存,最大限度地减少磁盘刷新?- 这只是一个猜测?
一般来说,我如何利用多个处理器/大量 RAM/和漂亮的磁盘?我要打开数据库两次然后从那里去吗?我不太确定在线程安全和事务方面会发生什么。如果我有两个数据库句柄,每个句柄都在一个事务中,那么在提交之前,第二个句柄是否可以立即写入,还是我需要先提交?
任何提示表示赞赏
here are the constraints
a) I've got a million records that need to be written into the DB as fast as possible
b) to fully generate the record for insertion there are two searches that need to occur within the same table (seeking keys)
c) This is a rebuild/regeneration of the DB - it either worked, or it didnt.
If it didnt there is no going back, a fresh rebuild/regeneration is
needed. I cannot restart mid process and without all the data none of
the data is valuable. READ: having one big transaction is fine if it
improves perf. I'd like ESE to cache, in ram, if that helps perf.
谢谢!