• The Query
  • Posts
  • 🤓 A trick to improve SQL query performance

🤓 A trick to improve SQL query performance

Good morning fellow data cruncher!

The Query here 👋

Here’s what we have for you today:

  • A trick to improve SQL query performance 📊

  • Writing SQL in Google Sheets 👨‍💻

  • Freelance and Full time Data Jobs 💼

  • Memes to brighten your day 🤣

select * from data-jobs

remote, data jobs

Open to exploring new job opportunities?

We cultivate the best data analyst jobs from around the internet to make your search easier.

Check out this week’s featured jobs here.

  1. GA4 Analyst @ Think Shout — $85-105 per hour

  2. Digital Marketing Analyst @ Corcentric — $110-130k per year

  3. Data Analyst @ Scan.com — $120-130k per year

freelance gigs

Need work experience? Get real experience with real projects.

  1. PowerBI Dashboard — $20 fixed price (apply here)

  2. Data Analyst for Looker — $75-140 per hour (apply here)

  3. SQL Data Analyst — $intermediate (apply here)

Thank you to our sponsors who keep this newsletter free to the reader:

With rising costs for Amazon S3 storage and potentially devastating business consequences from data loss, you need a holistic approach to cutting unnecessary spending and guarding against risks. Lawrence Miller, a consultant to multinational corporations who holds numerous networking certifications, has authored a concise volume that lays out the path to success in managing backup and compliance for S3 data lakes.

def content_spotlight(🔦):

Did you know you can write SQL in Google Sheets? Well, sort of. The QUERY function is one of the most interesting functions in Google Sheets for working with data.

It doesn’t have all the functionality of SQL but allows you to use some of the basics like SELECT, WHERE, GROUP BY, ORDER BY, etc. to select and filter data in a sheet.

This guide by Ben Collins should be all you need to get started!

class SQLMiniLesson:

A Trick to Improve SQL Performance

Kyle here 👋 — When you're working with SQL, it's crucial to write efficient queries to retrieve the data you need as quickly as possible.

One way to optimize performance is by ensuring that you use the ORDER BY clause only at the end of your query, rather than in subqueries or derived tables.

The reason behind this is that sorting data can be computationally expensive, especially when dealing with large datasets.

Here is an example of an inefficient ORDER BY at the beginning of a query vs. an efficient ORDER BY at the end.

By using ORDER BY at the end of your query, you give the database engine the opportunity to filter, join, or aggregate the data before sorting it.

This reduces the amount of data that needs to be sorted, making the process more efficient and faster.

import memes as 😂 

content & resources 🤓 

1. Become a Data Analyst Guide: Our full guide on what it takes to land a job as a data analyst.

2. Open Data Analyst Jobs: Find your next data job here!

3. Download our SQL Cheatsheet as a PDF and desktop wallpaper here. 

4. LinkedIn: We create content on LinkedIn daily. You can follow Cody here and Kyle here.

That’s it for today.

Stay crunchin’ folks and see you next week!

— Kyle & Cody

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

What'd you think of today's newsletter?

Login or Subscribe to participate in polls.