How do you interpret a query's explain plan?

后端 未结 11 1692
鱼传尺愫
鱼传尺愫 2020-12-02 05:12

When attempting to understand how a SQL statement is executing, it is sometimes recommended to look at the explain plan. What is the process one should go through in interpr

11条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 05:58

    One "Oh no, that's not right" is often in the form of a table scan. Table scans don't utilize any special indexes and can contribute to purging of every useful in memory caches. In postgreSQL, for example, you will find it looks like this.

    Seq Scan on my_table  (cost=0.00..15558.92 rows=620092 width=78)
    

    Sometimes table scans are ideal over, say, using an index to query the rows. However, this is one of those red-flag patterns that you seem to be looking for.

提交回复
热议问题