How to understand an EXPLAIN ANALYZE

前端 未结 2 1802
温柔的废话
温柔的废话 2020-12-07 23:13

I am not very familiar with looking at EXPLAIN ANALYZE results, I have a huge problem with my queries being too slow. I have tried to read up on how to interpret results fr

2条回答
  •  有刺的猬
    2020-12-07 23:25

    Well... the first thing I can tell you is that your database is expecting (from the statistics) to get 183 rows. In reality it is getting 25 rows. Although that is probably not too relevant in this case (i.e. with these small amounts and no heavy operations, don't have to worry about estimating it wrongly).

    A bigger problem (imho) is that a simple index lookup for 25 rows is taking 35ms. That seems a bit much. Is the database heavy enough to have at least all indexes in memory? It is not excessive though, just seems a bit slow for me.

    As for looking at your explains, I would recommend using explain.depesz.com: http://explain.depesz.com/s/sA6

提交回复
热议问题