What does database query and insert speed depend on?

前端 未结 5 754
耶瑟儿~
耶瑟儿~ 2021-02-04 17:29

At my work we have a small database (as in two hundred tables and maybe a total of a million of rows or so).

I\'ve always expected it to be quite fast in the order of se

5条回答
  •  無奈伤痛
    2021-02-04 17:34

    A "Rich Relational Dependency" model is not conducive to fast insert speeds. Every constraint (primary key, value checks, and especially foreign keys), must be checked for every inserted record. Thats a lot more work than a "simple insert".

    And it doesn't mtter that your inserts have no constraint violations, the time is probably going to be all in checking your foreign keys. Unless you have triggers also, because they're even worse.

    Of course is it possible that the only thing that is wrong is that your Insert table is the parent-FK for a must-have-children" FK relation for another table tha forgot to add an index for the child-FK side on the FK relation (this is not automatic and is often forgotten). Of course, that's just hoping to get lucky. :-)

提交回复
热议问题