Clustering depth of tables in Snowflake: a potential indicator of clustering health of a table

Clustering depth indicates if micro-partitions are overlapping with one another. Ideally, micro-partitions are not overlapping and are contiguous. Being contiguous means that one micro-partition seamlessly connects with another micro-partition. Sometimes however, micro-partitions are overlapping. A reason for this could be a less than optimal clustering key. Whatever the reason, this is not ideal, because now…

Correlated vs uncorrelated subqueries

A subquery is a query that is used in another query. Another example of subqueries can be as simple as the example below. A correlated subquery is a subquery where a reference is made to the outer query. An uncorrelated subquery is a subquery where no reference is made to the outer query. For the…

Importeer lokale data naar SQL Server

Wil je data van bijvoorbeeld een lokale schijf naar SQL Server migreren? Dit kan met behulp van de functie BULK INSERT, of Tasks > Import Data. Bij BULK INSERT heb je verschillende opties. In de onderstaande screenshot wordt een INSERT gedaan op de tabel Staging.FactTransactions. Het pad waar het bestand staat wordt gebruikt bij de…

Triggers in SQL

Hoe laat je een dimensie automatisch vullen bij elke nieuwe insert in een feitentabel? In SQL kunnen triggers gebruikt worden om dit probleem op te lossen. Triggers zijn een soort van stored procedures die op basis van gebeurtenissen in de database afgevuurd kunnen worden. Een trigger bestaat grofweg uit twee delen: Met behulp van triggers…