How to increase the performance of a Database?

后端 未结 10 2243
我在风中等你
我在风中等你 2021-02-14 15:15

I have designed databases several times in my company. To increase the performance of the database, I look for Normalisation and Indexing only.

If you were asked to incr

10条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-14 16:04

    Optimize the logical design

    The logical level is about the structure of the query and tables themselves. Try to maximize this first. The goal is to access as few data as possible at the logical level.

    • Have the most efficient SQL queries
    • Design a logical schema that support the application's need (e.g. type of the columns, etc.)
    • Design trade-off to support some use case better than other
    • Relational constraints
    • Normalization

    Optimize the physical design

    The physical level deals with non-logical consideration, such as type of indexes, parameters of the tables, etc. Goal is to optimize the IO which is always the bottleneck. Tune each table to fit it's need. Small table can be loaded permanently loaded in the DBMS cache, table with low write rate can have different settings than table with high update rate to take less disk spaces, etc. Depending on the queries, different index can be used, etc. You can denormalized data transparently with materialized views, etc.

    • Tables paremeters (allocation size, etc.)
    • Indexes (combined, types, etc.)
    • System-wide parameters (cache size, etc.)
    • Partitioning
    • Denormalization

    Try first to improve the logical design, then the physical design. (The boundary between both is however vague, so we can argue about my categorization).

    Optimize the maintenance

    Database must be operated correctly to stay as efficient as possible. This include a few mainteanance taks that can have impact on the perofrmance, e.g.

    • Keep statistics up to date
    • Re-sequence critical tables periodically
    • Disk maintenance
    • All the system stuff to have a server that rocks

提交回复
热议问题