LoslegenKostenlos loslegen

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

Kurs anzeigen

Anleitung zur Übung

  • Use the columns view from the information_schema.
  • Select the column_name, data_type, and is_nullable columns.
  • Use table_name to limit results to the daily_aqi table.

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
;
Code bearbeiten und ausführen