Topic

#SQL

43 posts tagged “SQL”.

The Lycoris Team The Lycoris Team · · 4 min read

Index Cardinality: Why Some Indexes Don't Help

Cardinality is how many distinct values a column has. Low-cardinality columns make poor index candidates because the database still scans most of the table.

#Databases #SQL #Computer Science
The Lycoris Team The Lycoris Team · · 4 min read

What Is a Database View?

A database view is a saved SQL query that behaves like a table — simplifying complex joins and restricting access, without storing the data twice.

#Databases #SQL #Data
The Lycoris Team The Lycoris Team · · 5 min read

Clustered vs Non-Clustered Index Explained

A clustered index determines the physical row order on disk; a non-clustered index is a separate lookup structure. How they differ and when to use each.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 4 min read

SQL CTEs vs Subqueries: When to Use Which

Common table expressions and subqueries both let you build a query from smaller pieces, but they differ in readability, reuse, and optimizer behavior.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

Natural Keys vs Surrogate Keys in Database Design

Natural keys use real-world data as a primary key; surrogate keys use a generated ID. Here's how to choose, with the trade-offs of each.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

PostgreSQL JSONB Explained

JSONB stores JSON in PostgreSQL as a parsed, indexable binary format instead of raw text. How it works, and when to reach for it.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

The N+1 Query Problem: What It Is and How to Fix It

The N+1 query problem fires one query per row instead of one query total, quietly turning a fast page into hundreds of round trips. How to spot and fix it.

#Databases #Performance #SQL
The Lycoris Team The Lycoris Team · · 5 min read

Hash Join vs Nested Loop Join vs Merge Join

Hash joins, nested loop joins, and merge joins are the three ways a database executes a JOIN — here's when the query planner picks each one.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 4 min read

Hash Index vs B-Tree Index: When to Use Each

A hash index gives O(1) equality lookups but no range scans; a B-tree supports both. Here's how the two database index types actually differ.

#Databases #SQL #Computer Science
Chisato Chisato · · 4 min read

What Is DuckDB? In-Process Analytics, Explained

DuckDB is an embedded, columnar SQL database built for fast analytical queries directly inside your application process. How it works.

#Databases #SQL #Data Engineering
The Lycoris Team The Lycoris Team · · 4 min read

What Is a Composite Index in a Database?

A composite index spans multiple columns in a fixed order, speeding up queries that filter or sort on that combination. How column order changes everything.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 5 min read

When to Denormalize a Database (and Why)

Denormalization trades write-time consistency for read-time speed by duplicating data — the right call once joins become your bottleneck.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

What Is a Database Cursor? Row-by-Row Traversal

A database cursor is a pointer that lets you fetch a query's result set one row at a time instead of all at once. How cursors work and when to use them.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

GROUP BY vs HAVING in SQL: What's the Difference

GROUP BY collapses rows into groups for aggregation; HAVING filters those groups afterward. How the two clauses differ and where each runs in query order.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

What Is a Bitmap Index?

A bitmap index uses a bit array per distinct value to speed up queries on low-cardinality columns, and combines multiple filters with fast bitwise AND/OR.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 6 min read

How to Read a Postgres EXPLAIN ANALYZE Query Plan

A step-by-step guide to running EXPLAIN ANALYZE in PostgreSQL and reading the query plan it returns — node types, costs, and where the real time went.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 5 min read

What Is a Database Trigger?

A database trigger is a procedure that runs automatically on an insert, update, or delete — enforcing rules the application layer can't guarantee.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 5 min read

Postgres Index Types: B-Tree vs GIN vs GiST

Postgres offers several index types beyond the default B-tree. When GIN and GiST outperform it for arrays, JSONB, full-text search, and ranges.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 5 min read

What Is a Covering Index?

A covering index holds every column a query needs, letting the database answer from the index alone without a lookup back to the table.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 4 min read

Primary Key vs Foreign Key vs Unique Constraint

Primary keys identify a row, foreign keys link one table to another, and unique constraints just prevent duplicates. How the three differ in SQL.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

Database Deadlocks Explained: Causes and Prevention

A database deadlock happens when two transactions each wait on a lock the other holds. Why deadlocks occur, how databases detect them, and how to avoid them.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

How Database Query Optimizers Work

A query optimizer turns declarative SQL into an execution plan by estimating the cost of alternative strategies. How that estimation works and how to read a plan.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 5 min read

What Is SQLite? The Database Inside Your App

SQLite is a serverless, file-based SQL database compiled directly into an application. How it works, why it's everywhere, and when to reach for it.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 5 min read

What Is a Read Replica? Database Scaling Explained

A read replica is a synced copy of a database that serves read queries, taking load off the primary. How replication lag and failover actually work.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

What Is a CTE? Common Table Expressions Explained

A CTE is a named, temporary result set defined with WITH that you can reference elsewhere in a SQL query. How they work and when to use one.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

Optimistic vs Pessimistic Locking in Databases

Optimistic locking checks for conflicts at write time; pessimistic locking blocks other writers up front. How each works and when to pick one.

#Databases #Backend #SQL
The Lycoris Team The Lycoris Team · · 4 min read

What Is Write-Ahead Logging (WAL)?

Write-ahead logging records changes to a log before applying them to a database, making crash recovery and replication possible. Here's how it works.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 5 min read

The N+1 Query Problem and How to Fix It

The N+1 query problem turns one database request into hundreds by issuing a separate query per row. Here's how to spot it and fix it.

#Databases #SQL #Performance
The Lycoris Team The Lycoris Team · · 4 min read

OLTP vs OLAP: Two Very Different Ways to Query Data

OLTP systems handle many small, fast transactions like orders and logins; OLAP systems run large analytical queries across historical data for reporting.

#Databases #SQL #Backend
Chisato Chisato · · 4 min read

SQL Window Functions Explained (With Examples)

SQL window functions compute values across a set of rows without collapsing them, unlike GROUP BY. How OVER, PARTITION BY, and ranking work.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

ACID Transactions Explained: Database Guarantees

ACID — atomicity, consistency, isolation, durability — defines the guarantees a database transaction makes so concurrent, failure-prone operations stay correct.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

What Is Database Normalization? A Practical Guide

Database normalization organizes tables to eliminate redundant data and update anomalies. The normal forms explained with a worked example.

#Databases #SQL #Backend
The Lycoris Team The Lycoris Team · · 4 min read

What Is Database Indexing? Faster Queries, Explained

A database index is a sorted data structure that lets the engine find rows without scanning the whole table. How indexes work, and when they help or hurt.

#Databases #SQL #Performance

← All topics