Posts

Showing posts from July, 2021

Beginners Guide For Faster, Cost-Effective SQL Queries

Image
Often when people are starting off writing queries with SQL or via tools like Tableau or Power BI, they are often not very well optimized. Writing well-structured, narrow queries accomplish a few goals. The first is allowing you to ask questions and get results as quickly as possible. Overly broad queries can take a LONG time to complete. The second goal is reducing costs. Systems like BigQuery, Snowflake, Amazon Redshift Spectrum and Amazon Athena charge you for the compute resources required to execute your queries. Overly broad queries are much more expensive to run. For example, let us assume you have a table of Amazon orders data from Seller Central. There are about two years of data present which totals 200 GB of data. Here is a simple, unoptimized query; SELECT * FROM myorders; Running an unoptimized query like this will take some time to complete. Not only will it be slower, but it is also more expensive. For example, Amazon Athena charges $5 per TB of data scanned. Runn