Améliorer la performance des requêtes dans PostgreSQL
Amy McCarty
Instructor
Quoi ?
Pourquoi ?
Comment ?
| holiday | holiday_type | country_code |
|---|---|---|
| Epiphany | religious | CZE |
| Epiphany | religious | FRA |
| Epiphany | religious | USA |
| Thanksgiving | secular | USA |
CREATE TEMP TABLE usa_holidays AS
SELECT holiday, holiday_type
FROM world_holidays
WHERE country_code = 'USA';
Jours fériés aux États‑Unis
| holiday | holiday_type |
|---|---|
| Epiphany | religious |
| Thanksgiving | secular |
| Statistiques | World Holidays | USA Holidays |
|---|---|---|
| Type | table | temp table |
| # de lignes | 591 444 | 25 |
| Statistiques | World Holidays | USA Holidays |
|---|---|---|
| Type | view | temp_table |
| # de lignes | 591 444 | 25 |
| Sources | 195 | 1 |
CREATE TEMP TABLE usa_holidays AS
SELECT holiday, holiday_type
FROM world_holidays
WHERE country_code = 'USA';
WITH religious AS
( SELECT usa.holiday, r.initial_yr
, r.celebration_dt
FROM religious r
INNER JOIN usa_holidays usa
USING (holiday) )
, secular AS
( SELECT usa.holiday, s.initial_yr
, s.celebration_dt
FROM secular s
INNER JOIN usa_holidays usa
USING (holiday) )
, ...
1 CREATE TEMP TABLE usa_holidays AS
2 SELECT holiday, holiday_type
3 FROM world_holidays
4 WHERE country_code = 'USA';
5
6 ANALYZE usa_holidays;
7
8 SELECT * FROM usa_holidays
Planificateur de requêtes (étapes d'exécution)

Améliorer la performance des requêtes dans PostgreSQL