Re: Slow query, possibly not using index

Поиск
Список
Период
Сортировка
От Les
Тема Re: Slow query, possibly not using index
Дата
Msg-id CAKXe9UDtz=BqycNXmwHXFY7=1NN6diyXZ23UO3dC9D_jdtTAmw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Slow query, possibly not using index  (Les <nagylzs@gmail.com>)
Ответы Re: Slow query, possibly not using index  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-performance



=# select * from pgstatindex('media.idx_block_unused');
 version | tree_level | index_size | root_block_no | internal_pages | leaf_pages | empty_pages | deleted_pages | avg_leaf_density | leaf_fragmentation
---------+------------+------------+---------------+----------------+------------+-------------+---------------+------------------+--------------------
       4 |          2 |  389677056 |           546 |            114 |      23069 |           0 |         24384 |            90.03 |                  0
(1 row)


After reindex:

=# select * from pgstatindex('media.idx_block_unused');
 version | tree_level | index_size | root_block_no | internal_pages | leaf_pages | empty_pages | deleted_pages | avg_leaf_density | leaf_fragmentation
---------+------------+------------+---------------+----------------+------------+-------------+---------------+------------------+--------------------
       4 |          0 |       8192 |             0 |              0 |          0 |           0 |             0 |              NaN |                NaN
(1 row)

 explain analyze select id from media.block b where nrefs =0 limit 1

QUERY PLAN                                                                                                                               |
-----------------------------------------------------------------------------------------------------------------------------------------+
Limit  (cost=0.14..0.46 rows=1 width=16) (actual time=0.010..0.011 rows=0 loops=1)                                                       |
  ->  Index Only Scan using idx_block_unused on block b  (cost=0.14..698.91 rows=2231 width=16) (actual time=0.008..0.009 rows=0 loops=1)|
        Heap Fetches: 0                                                                                                                  |
Planning Time: 0.174 ms                                                                                                                  |
Execution Time: 0.030 ms                                                                                                                 |

It is actually empty.

Now I only need to figure out why autovacuum did not work on the index.

Thank you

    Laszlo

В списке pgsql-performance по дате отправления:

Предыдущее
От: Les
Дата:
Сообщение: Re: Slow query, possibly not using index
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: Slow query, possibly not using index