Baron Schwartz's Website
Archives Talks

MySQL Command-Line Tip: Compare Result Sets

Published Mar 25, 2009 by Baron Schwartz in Databases, Open Source at https://www.xaprb.com/blog/2009/03/25/mysql-command-line-tip-compare-result-sets/

Here’s a quick productivity tip: when optimizing queries by rewriting them to different forms that should return the same results, you can verify that you get the same results by taking a checksum of them.

Just set your pager to md5sum:

mysql> pager md5sum -
PAGER set to 'md5sum -'
mysql> select * from test;
a09bc56ac9aa0cbcc659c3d566c2c7e4  -
4096 rows in set (0.00 sec)

Baron Schwartz

I’m a founder, author of several books, and creator of various open-source software. I write about topics such as technology, mindfulness, and fitness, and I tweet at @xaprb. More about me.

Story logo

© 2020 Baron Schwartz