Query-Profil, Verlauf und Insights

Automatisierung von Datenpipelines in Snowflake

Emily Melhuish

Technical Curriculum Developer, Snowflake

Warum Query-Profil

Operations-Dashboard

  • Snowflake scannt evtl. Daten, die es gar nicht braucht
Automatisierung von Datenpipelines in Snowflake

Query-Profil in Snowsight öffnen

Zugriff auf Query-Profil

Zugriff über: Monitoring > Query History > [Query wählen] > Tab Query Profile

Automatisierung von Datenpipelines in Snowflake

Die Operator-Tree lesen

Snowsight Query-Profil mit Operator-Graph und Panel „Teuerste Knoten“

Automatisierung von Datenpipelines in Snowflake

Vier häufige Probleme im Query-Profil

Explodierende Joins

  • Erzeugen mehr Zeilen, als sie verbrauchen können

Union ohne ALL

  • Fügt über dem UNION ein Aggregate ein, um Duplikate zu entfernen
  • Kosten = zusätzliche Zeit

Spill auf Platte

  • Speicherintensive Operatoren gehen der RAM aus
  • Z. B. Aggregates, Sorts oder große Joins

Ineffizientes Pruning

  • Sichtbar, wenn gescannte Partitionen ~ Gesamtzahl sind
  • Filter greifen nicht effektiv
Automatisierung von Datenpipelines in Snowflake

Spill auf Platte: Lokal vs. Remote

  • Lokales Spill → Warehouse-SSD – langsamer als RAM, aber ok
  • Remote-Spill → Cloud-Speicher – viel langsamer; beheben!

Diagnose-Query

SELECT 
query_id,
bytes_spilled_to_local_storage,
bytes_spilled_to_remote_storage
FROM SNOWFLAKE.ACCOUNT_USAGE.QUERY_HISTORY
WHERE bytes_spilled_to_remote_storage > 0
ORDER BY bytes_spilled_to_remote_storage DESC
LIMIT 10;
Automatisierung von Datenpipelines in Snowflake

QUERY_HISTORY: Sicht auf Kontoebene

  • ACCOUNT_USAGE.QUERY_HISTORY – View mit 365 Tagen Aufbewahrung
  • INFORMATION_SCHEMA.QUERY_HISTORY() Table Function mit 7 Tagen Aufbewahrung

Screenshot des ausgeführten Query-Verlaufs

Automatisierung von Datenpipelines in Snowflake

Query Insights: Automatische Empfehlungen

Query Insights Empfehlung

Automatisierung von Datenpipelines in Snowflake

Lass uns üben!

Automatisierung von Datenpipelines in Snowflake

Preparing Video For Download...