PostgreSQL'de Sorgu Performansını İyileştirme
Amy McCarty
Instructor
Ne
Neden
Nerede
| malzeme | tarif |
|---|---|
| domates | spagetti ve köfte |
| taze soğan | kızarmış pilav |
| yumurta | kızarmış pilav |
| kıyma | spagetti ve köfte |
| makarna | spagetti ve köfte |
| pirinç | kızarmış pilav |
| soya sosu | kızarmış pilav |
SELECT *
FROM cookbook
WHERE recipe = 'fried rice'

SELECT * FROM pg_indexes
| schemaname | tablename | indexname | tablespace | indexdef |
|---|---|---|---|---|
| food | dinner | recipe_index | null | CREATE INDEX recipe_index ... |

CREATE INDEX recipe_index
ON cookbook (recipe);
CREATE INDEX CONCURRENTLY recipe_index
ON cookbook (recipe, serving_size);
Dizin kullanın
Dizinden kaçının
Sık güncellenen tablolar

Sorgu planlayıcı
EXPLAIN
SELECT *
FROM cookbook
Sorgu Planı
Seq scan on cookbook (cost=0.00...22.70
rows = 1270 width = 36)
PostgreSQL'de Sorgu Performansını İyileştirme