SQLite insert speed slows as number of records increases due to an index

前端 未结 5 1438
無奈伤痛
無奈伤痛 2020-11-29 19:59

Original question

Background

It is well-known that SQLite needs to be fine tuned to achieve insert speeds on the order of 50k inserts/s. There are many q

5条回答
  •  星月不相逢
    2020-11-29 20:24

    I suspect the Index's hash value collision causes the insert speed slow.

    When we have many many rows in one table, and then the indexed column hash value collision will happen more frequently. It means Sqlite engine needs to calculate the hash value two times or three times, or maybe even four times, in order to get a different hash value.

    So I guess this is the root cause of the SQLite insert slowness when the table has many rows.

    This point could explain why using shards could avoid this problem. Who's a real expert in SQLite domain to confirm or deny my point here?

提交回复
热议问题