CockroachDB Videos
← Back to all videos

Developing with CockroachDB: SQL Query Optimizations for Speed & Efficiency

2021-09-30

Past Live Streams

Description

This is a hands-on-keyboard live lab session in which Steven Hand & Rain Leander are going to demonstrate various ways to optimize your SQL queries for speed in some cases and cost/efficiency in other cases. They'll show you how to monitor query performance, what to look for (and where to look) and then they'll give you some different best practices for fixing queries that are behaving poorly. 00:00 Introduction to Developing with CockroachDB 18:00 The Live Demo Begins 18:01 Link to the live lab: https://github.com/cockroachlabs/developer-success/blob/main/query-optimization.md 19:20 How to use Primary Keys with CockroachDB 21:00 Insert multiple rows with one SQL Statement 21:30 Giving data to CockroachDB 26:45 When is an index in CockroachDB used or not used? 29:30 Demo of fixing a bad query in which an index is used 30:35 Why you see a join when only one table is present in CockroachDB 31:30 Looking at the indexes in a table in CockroachDB (indexes are defined on multiple columns) 32:30 Pulling up a table definition in CockroachDB 35:00 How to do EXPLAIN ANALYZE in CockroachDB 38:00 EXPLAIN a query that does not have an index 39:50 EXPLAIN ANALYZE with a SELECT plan 41:10 How to add a covering index 42:40 how to remove an index scan 43:45 How to performance testing with CockroachDB 44:30 What is cardinality? 45:50 Code audit best practices 48:50 What are Join Methods in relational databases? There will be an Office Hours session to accompany this stream where Rain & Co. answer any questions about CockroachDB and Query Optimization: https://youtu.be/pZGw4_7SFek