LoslegenKostenlos loslegen

Finding the database indexes

One aspect of writing well-performing queries is using the database optimization properties. When working in row-oriented databases, you want to limit the number of records returned. If partitions and indexes exist, you should use them in your queries as filters. Ideally, you could reference a database diagram or ask your friendly database administrator (DBA) which tables and columns have indexes.

However, sometimes documentation is missing, and DBAs are busy. Luckily, the pg_tables schema has views that show all the existing indexes.

Diese Übung ist Teil des Kurses

Improving Query Performance in PostgreSQL

Kurs anzeigen

Anleitung zur Übung

  • Choose metadata from the pg_indexes view.
  • Select tablename and indexname to see the indexes in each table.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

SELECT ___
 , ___
FROM ___;
Code bearbeiten und ausführen