PostgreSQL'de Sorgu Performansını İyileştirme
Amy McCarty
Instructor
Sütun odaklı depolama
| id | name | species | age | habitat | received |
|---|---|---|---|---|---|
| 01 | Bob | panda | 2 | Asia | 2018 |
| 02 | Sunny | zebra | 3 | Africa | 2018 |
| 03 | Beco | zebra | 10 | Africa | 2017 |
| 04 | Coco | koala | 5 | Australia | 2016 |
Şu şekilde depolanır

Sütun odaklı depolama özellikleri
Analitik odak
Şu şekilde depolanır

Satır ilişkileri korunur
İşlemsel odak
Şu şekilde depolanır

| Postgres | Citus Data, Greenplum, Amazon Redshift |
| MySQL | MariaDB |
| Oracle | Oracle In-Memory Cloud Store |
| Clickhouse, Apache Druid, CrateDB |
Sütunları azaltma
SELECT * ifadesini sınırlı kullanınSELECT column_name, data_type
FROM information_schema.columns
WHERE table_catalog = 'schema_name'
AND table_name = 'zoo_animals'
| column_name | data_type |
|---|---|
| id | integer |
| name | text |
| species | text |
Sütunları azaltma
SELECT * ifadesini sınırlı kullanınSELECT column_name, data_type
FROM information_schema.columns
WHERE table_catalog = 'schema_name'
AND table_name = 'zoo_animals'
| column_name | data_type |
|---|---|
| id | integer |
| name | text |
| species | text |
| id | name | species | age | habitat | received |
|---|---|---|---|---|---|
| 01 | Bob | panda | 2 | Asia | 2018 |
| 02 | Sunny | zebra | 3 | Africa | 2018 |
| 03 | Beco | zebra | 10 | Africa | 2017 |
| 04 | Coco | koala | 5 | Australia | 2016 |
-- Sütun odaklı yapı
SELECT MIN(age), MAX(age)
FROM zoo_animals
WHERE species = 'zebra'
-- Satır odaklı yapı
SELECT *
FROM zoo_animals
WHERE species = 'zebra'
ORDER BY age
PostgreSQL'de Sorgu Performansını İyileştirme