Redshift vs Snowflake vs BigQuery: Choosing a Warehouse
Tags: database, opensource, go, rudderstack
Published: 2020-03-18 08:37:00

<!-- wp:paragraph -->
<p>In our previous blog post, we described our experience setting up an <a href="https://rudderstack.com/blog/open-source-analytics/">Open-Source Analytics Stack</a> using RudderStack, Apache SuperSet, and Redshift. When it comes to choosing a data warehouse for the open-source analytics stack, it is very common to pit data warehouses against each other. Redshift vs BigQuery, Redshift vs Snowflake, etc. are some common examples. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>In this post, we will go into the reasoning behind choosing AWS Redshift over other popular data warehousing solutions such as Google BigQuery and Snowflake.</p>
<!-- /wp:paragraph -->

<!-- wp:heading -->
<h2>Background</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p><a href="https://aws.amazon.com/redshift/">AWS Redshift</a> and <a href="https://cloud.google.com/bigquery/?utm_source=google&amp;utm_medium=cpc&amp;utm_campaign=japac-IN-all-en-dr-bkwsrmkt-all-super-trial-e-dr-1008074&amp;utm_content=text-ad-none-none-DEV_c-CRE_300622148359-ADGP_Hybrid+%7C+AW+SEM+%7C+BKWS+~+T1+%7C+EXA+%7C+Big+Data+%7C+1:1+%7C+IN+%7C+en+%7C+google+bigquery-KWID_43700037527390287-kwd-63326440124&amp;userloc_1007785&amp;utm_term=KW_google%20bigquery&amp;gclid=Cj0KCQiAvc_xBRCYARIsAC5QT9n7yerZcDbxUD8WM0SP7tVHfoCW7hbwDYOUZblXv1EhxBSa_3Tu5AwaAkkDEALw_wcB">Google BigQuery</a> are market leaders for cloud-based data warehouse solutions available today. As they both utilize columnar storage, they offer improved performance over traditional RDBMS. These platforms provide mature, intuitive management consoles and a rich set of programmatic interfaces. On the other hand, <a href="https://www.snowflake.com/">Snowflake</a> has emerged as a modern data warehouse solution with features such as ease of access, instant scalability, as well as powerful analytics and security.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>For this comparison, we used a data set that consists of approximately 20 million event records, triggered directly or indirectly by the users of a <a href="https://rudderstack.com/blog/customer-case-study-casino-game/">mobile casino game</a>. The mobile application contains multiple games - both free and paid - that mimic the casino slot machines.</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Data for comparison</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We used the data from the following three tables:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li><strong><code>revenue</code></strong> - details for purchase events</li><li><strong><code>spin_result</code></strong> - details for events triggered by automatic or manual player spin action</li><li><strong><code>tracks</code></strong> - parent table containing common details of all events</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Evaluation Methodology</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>We compared Redshift vs BigQuery vs Snowflake on two major aspects - <strong>performance </strong>and <strong>cost</strong>. For performance evaluation, we ran a set of 11 queries that were used extensively by the product managers of the gaming application on each of the data warehouses. As the pricing model varies across the three data warehouses, we also made an attempt to create a common cost evaluation standard based on usage.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Some other considerations that guided this performance comparison exercise were:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li>Data loading time was not considered as part of this exercise.</li><li>Performance comparisons were done using two Redshift cluster configurations (one with single dc2.large instance and another with two dc2.large instances). Higher configurations were deemed to be too costly for the given setup as discussed later.</li><li>All the queries were executed from a Python program. The module used for accessing Redshift was <strong>psycopg2</strong> while we used the <strong>google.cloud</strong> module for BigQuery. For Snowflake, <strong>SnowSQL</strong> i.e. the <strong>Snowflake Command Line Interface</strong> was used</li><li>Multiple readings were taken to balance one-off factors such as network disruptions.</li><li><strong>No platform optimizations, </strong>vendor-provided or otherwise, were implemented during the exercise.</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Cost Comparison: Redshift vs BigQuery vs Snowflake</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>When comparing the cost of data storage for running the queries, the following are the key takeaways for each data warehouse:</p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>AWS Redshift</h3>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>For <strong>dc2.large</strong> with <strong>160GB/node</strong> storage, the cost is<strong> $0.25/node/hour</strong>, that is <strong>$180/month</strong> + <strong>no cost for processing queries</strong>.</li><li>As we use<strong> two</strong> dc2.large nodes for each cluster, the total cost comes up to <strong>$360/month</strong>.</li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":3} -->
<h3>Google BigQuery</h3>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>BigQuery charges <strong>$20/TB/month</strong> for storage and <strong>$5/TB </strong>for queries.</li><li>The total cost of running the 11 queries (<strong>only once</strong>) came up to roughly around <strong>$0.56.</strong></li><li>The size of the dataset being queried is <strong>39.30 GB, </strong>that is, <strong>0.0393 TB. </strong>Therefore, the storage cost per month came up to around<strong> $0.79.</strong></li></ul>
<!-- /wp:list -->

<!-- wp:heading {"level":3} -->
<h3>Snowflake</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Snowflake offers different kinds of platforms that can be opted for, as per our usage. For this exercise, we used the <strong>Business Critical</strong> platform for our data storage. It also offers two types of services:</p>
<!-- /wp:paragraph -->

<!-- wp:list -->
<ul><li><strong>On-demand</strong>: Snowflake charges <strong>$40/TB per month</strong> for storage. Although our total cost of storage comes to $40 * 0.0393 TB = $1.57/month, there is a <strong>$25</strong> <strong>minimum monthly charge</strong> for on-demand customers.</li><li><strong>Pre-purchased</strong>: Snowflake offers a pre-purchased plan of <strong>$23/TB/month</strong> for data storage.</li></ul>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p>For querying, <strong>SnowFlake Credits</strong> are used to pay for the consumption of the cloud services that exceed 10% of the daily usage of the compute resources. The total number of credits used for executing the 11 queries is 1.866761388. Given the cost per credit for a business-critical platform is <strong>$4</strong>, the total cost of querying comes to $4*1.866761388&nbsp; = <strong>$7.5</strong>.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Key Takeaways</h3>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>If the queries are run just <strong>once</strong> in a month, Redshift is approximately <strong>267</strong> <strong>times more expensive</strong> <strong>than BigQuery</strong>.</li><li>When it comes to storing and querying data in BigQuery as compared to Snowflake, the cost of storing and running the queries once on the former (<strong>$1.35</strong>) was much less than doing so in the latter (<strong>$7.5</strong>).</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Performance Comparison: Redshift vs BigQuery vs Snowflake</h2>
<!-- /wp:heading -->


<!-- wp:paragraph -->
<p>The following table shows the performance comparison when it comes to  Redshift vs BigQuery vs Snowflake, as per our exercise:</p>
<!-- /wp:paragraph -->

<!-- wp:table -->
<figure class="wp-block-table"><table class=""><tbody><tr><td><strong>Query</strong></td><td><strong>Redshift (1 dc2.large)</strong>  </td><td><strong>Redshift (1 dc2.large)</strong> </td><td><strong>Redshift (1 dc2.large)</strong> </td><td><strong>Redshift (1 dc2.large)</strong> </td><td><strong>Redshift (2 dc2.large)</strong> </td><td><strong>Redshift (2 dc2.large)</strong> </td><td><strong>Redshift (2 dc2.large)</strong> </td><td><strong>Redshift (2 dc2.large)</strong> </td><td><strong>Snowflake</strong> </td><td><strong>Snowflake</strong> </td><td><strong>Snowflake</strong> </td><td><strong>Snowflake</strong> </td><td><strong>BigQuery</strong></td><td> <strong>BigQuery</strong> </td><td> <strong>BigQuery</strong> </td><td> <strong>BigQuery</strong> </td></tr><tr><td></td><td><strong>1st Query Execution Time</strong><br><strong>(seconds)</strong></td><td><strong>Average of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Median&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Standard Deviation&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>1st Query Execution Time</strong><br><strong>(seconds)</strong></td><td><strong>Average of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Median&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Standard Deviation&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>1st Query Execution Time</strong><br><strong>(seconds)</strong></td><td><strong>Average of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Median&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Standard Deviation&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>1st Query Execution Time</strong><br><strong>(seconds)</strong></td><td><strong>Average of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Median&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong></td><td><strong>Standard Deviation&nbsp; of Remaining 4 columns&nbsp;</strong><br><strong>(seconds)</strong><br> </td></tr><tr><td><strong>Q1</strong></td><td>17.66056</td><td>0.2816</td><td>0.2500</td><td>0.6006&nbsp;</td><td>4.39874</td><td>0.5031</td><td>0.2509</td><td>0.4390</td><td>4.352</td><td>1.5266</td><td>0.387</td><td>1.591</td><td>2.08194</td><td>0.6006&nbsp;</td><td>0.4390</td><td>0.0519</td></tr><tr><td><strong>Q2</strong></td><td>20.70354</td><td>0.2637</td><td>0.2534</td><td>0.0295</td><td>3.93964</td><td> 0.5189</td><td>0.2827</td><td>0.4307</td><td>1.733</td><td><br>0.6088</td><td>0.333</td><td>0.5621</td><td>0.68288</td><td>0.5473</td><td>0.5465</td><td>0.0422</td></tr><tr><td><strong>Q3</strong></td><td>17.46567</td><td>0.2683</td><td>0.2482</td><td>0.0415</td><td>3.91162</td><td>0.2465</td><td>0.2462</td><td>0.0015</td><td>1.187</td><td>0.5088</td><td>0.349</td><td>0.339</td><td>0.60482</td><td>0.5309</td><td>0.5229</td><td>0.0481</td></tr><tr><td><strong>Q4</strong></td><td>29.12982</td><td> 0.5341</td><td>0.5384</td><td>0.0365</td><td>4.70708</td><td>0.7002</td><td>0.6641</td><td>0.1830</td><td>1.784</td><td>0.6556</td><td>0.399</td><td>0.5649</td><td>0.63746</td><td>0.5203</td><td>0.5173</td><td>0.0282</td></tr><tr><td><strong>Q5</strong></td><td>7.10846</td><td>0.2470</td><td>0.2471</td><td>0.0048</td><td>3.58540</td><td>0.2472</td><td>0.2473</td><td>0.0010</td><td>1.847<br></td><td>1.0298</td><td>1.267</td><td>0.5730</td><td>0.70232</td><td>0.8076</td><td>0.7428</td><td>0.2236</td></tr><tr><td><strong>Q6</strong></td><td>2.50200</td><td>0.26749</td><td> 0.2518</td><td>0.0369</td><td>3.47770</td><td>0.4200</td><td>0.3334</td><td>0.2030</td><td>4.598</td><td>1.4046</td><td>0.354</td><td>1.6529</td><td>0.55107</td><td>0.6096</td><td>0.6158</td><td>0.1063</td></tr><tr><td><strong>Q7</strong></td><td>2.47661</td><td> &nbsp; 0.2643</td><td>0.2501</td><td>0.0395</td><td>3.42400</td><td> 0.2928</td><td>0.2860</td><td>0.2030</td><td>0.365</td><td>0.3472</td><td><br>0.365</td><td>0.0287</td><td>0.63842</td><td>0.5221</td><td>0.6105</td><td>0.1585</td></tr><tr><td><strong>Q8</strong></td><td>2.52171</td><td>0.256</td><td>0.2416</td><td>0.0285</td><td>3.59205</td><td>0.2606</td><td>0.2501</td><td>0.0204</td><td>0.853</td><td>1.0672</td><td>1.264</td><td>0.423</td><td>0.58993</td><td>0.5653</td><td>0.5460</td><td>0.0448</td></tr><tr><td><strong>Q9</strong></td><td>11.16986</td><td>0.2612</td><td>0.2556</td><td>0.0124</td><td>4.63495</td><td>0.2547</td><td>0.2497</td><td>0.0116</td><td>9.727</td><td>2.7792</td><td>1.346</td><td>3.4952</td><td>0.64536</td><td>0.5552</td><td>0.5297</td><td>0.0473</td></tr><tr><td><strong>Q10</strong></td><td>28.49286</td><td>0.2741</td><td>0.2750</td><td>0.0340</td><td>10.89786</td><td>0.5594</td><td>0.2518</td><td>0.5352</td><td>7.381</td><td>2.1494</td><td>1.240</td><td>2.646</td><td>0.54803</td><td>0.5445</td><td>0.5492</td><td>0.0204</td></tr><tr><td><strong>Q11</strong></td><td>8.57887</td><td>0.8989</td><td>0.8791</td><td>0.0368</td><td>14.84757</td><td>0.6693</td><td>0.5452</td><td>0.2285</td><td>2.992</td><td>0.89</td><td>0.358</td><td>1.051</td><td>0.61591</td><td>0.6673</td><td>0.6370</td><td>0.1444</td></tr></tbody></table></figure>
<!-- /wp:table -->

<!-- wp:paragraph -->
<p></p>
<!-- /wp:paragraph -->

<!-- wp:heading {"level":3} -->
<h3>Key Takeaways</h3>
<!-- /wp:heading -->

<!-- wp:list -->
<ul><li>In terms of query execution time, the first readings of Redshift with one node are <strong>much higher</strong> than both Snowflake and Redshift with 2 nodes.</li><li>Redshift <strong>seems to cache data</strong> while BigQuery does not, by default</li></ul>
<!-- /wp:list -->

<!-- wp:heading -->
<h2>Conclusion</h2>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Based on the performance and cost evaluation of the three warehouses, we see that using Redshift as our preferred data warehouse solution makes sense. Considering there are large numbers of real-time or near real-time dashboards that are being accessed by a high number of users, Redshift gives us the best RoI on the performance and cost aspects.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>For a detailed appendix that captures the actual times recorded during the execution of queries, please <a rel="noreferrer noopener" aria-label="click here (opens in a new tab)" href="https://rudderstack.com/wp-content/uploads/2020/03/Appendix.pdf" target="_blank">click here</a>.</strong></p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><p>Editor's note: This article was originally published in December 2019. It has been completely rewritten for accuracy.</p></blockquote>
<!-- /wp:quote -->