Comparing Data With CHECKSUM

David Fowler shows how to use CHECKSUM and CHECKSUM_AGG to compare data:

There are times when we need to compare two tables and figure out if the data matches. I often see a number of ways of doing this suggested, most are quite slow and inefficient. I’d quite like to share a quick and slightly dirty way of doing this using the CHECKSUM and CHECKSUM_AGG functions.

Just a reminder that CHECKSUM() will generate a checksum for an entire row or selection of columns in the row.

Will generate a checksum for a dataset.

David then has a couple of examples showing these in action.

Related Posts

Using APPLY to Reduce Function Calls

Erik Darling shows a clever use of the APPLY operator: A while back, Jonathan Kehayias blogged about a way to speed up UDFs that might see NULL input. Which is great, if your functions see NULL inputs. But what if… What if they don’t? And what if they’re in your WHERE clause? And what if they’re in […]

Read More

Case-Insensitive Searches in Snowflake

Koen Verbeeck shows how you can perform case-insensitive searches in Snowflake DB: I’m doing a little series on some of the nice features/capabilities in Snowflake (the cloud data warehouse). In each part, I’ll highlight something that I think it’s interesting enough to share. It might be some SQL function that I’d really like to be in SQL […]

Read More


December 2018
« Nov Jan »