23 Ekim 2023 Pazartesi

HypoPG - Hypothetical Indexes

Giriş
Açıklaması şöyle
We all know how indexes can optimize query plans if used carefully. Since index creation requires resources, it would have been nice to have a way to know beforehand whether postgres will use those indexes or not.

HypoPg, a postgres extension lets you do just that. It can be used to create a hypothetical index without costing you resources and enables you to analyse the index performance.
Kurulum
Şöyle yaparız
CREATE EXTENSION hypopg;
hypopg_create_index metodu
Şöyle yaparızSequence Scan veya Index Scan kullanıldığını gösterir
SELECT * FROM hypopg_create_index('CREATE INDEX ON mytable (id)');
EXPLAIN SELECT * FROM mytable WHERE id = 1;
Diğer
Açıklaması şöyle
hypopg_reset() — to clear the previous effects of other indexes
hypopg_drop_index(indexrelid) — to remove your backend’s hypothetical indexes
hypopg_hide_index(oid) — to hide an index
hypopg_unhide_index(oid) — to restore the index

Hiç yorum yok:

Yorum Gönder