Using the information schema
The most basic optimization method with column-oriented storage databases is to reduce the number of columns each query returns.
When working with new tables, it is common to select the first 5 or 10 rows. However, a basic select on a wide table may be resource intensive. The information schema provides some column metadata and is a good starting place to learn about your data.
While it does not show as available, views in the information_schema are always available to query. Feel free to explore the columns view in the console to explore what information is available before completing the exercise.
Diese Übung ist Teil des Kurses
Improving Query Performance in PostgreSQL
Anleitung zur Übung
- Use the
columnsview from theinformation_schema. - Select the
column_name,data_type, andis_nullablecolumns. - Use
table_nameto limit results to thedaily_aqitable.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
-- Examine metadata about daily_aqi
SELECT ___ , ___ , ___
FROM ___
WHERE table_catalog = 'olympics_aqi'
AND ___ = ___ -- Limit to a specific table
;