Loading topic
FROM clause is called a derived table. It produces a temporary result that the outer query can treat like a table. Without LATERAL, that subquery is independent of the other items listed in FROM.3 min readSELECT, WHERE, ORDER BY, LIMIT, joins, subqueries in FROM, and table aliases. This chapter explains the evaluation rule that makes a PostgreSQL LATERAL join useful.3 min readSELECT, WHERE, ORDER BY, LIMIT, table aliases, and basic INNER JOIN and LEFT JOIN syntax. It also assumes you have used subqueries in the FROM clause.2 min readSELECT, WHERE, ORDER BY, and LIMIT, along with inner joins, left joins, FROM subqueries, and table aliases.2 min readSELECT, WHERE, ORDER BY, LIMIT, joins, table aliases, and subqueries in FROM. This chapter uses PostgreSQL's LATERAL keyword to return a limited number of rows for every group.3 min readSELECT, joins, table aliases, arrays, JSONB, and subqueries in FROM. It also assumes you understand that LATERAL lets a FROM item refer to columns from items listed before it.2 min readSELECT, joins, table aliases, and basic JSONB operators. This chapter uses PostgreSQL's jsonb type. A jsonb value stores JSON in a form that PostgreSQL can query efficiently.2 min readSELECT statements, table aliases, and joins. This chapter focuses on a small but useful pattern: use LATERAL to calculate a value for each row, give that value a name, and reuse the name in the rest of the query.3 min readSELECT, joins, subqueries in FROM, table aliases, and ORDER BY with LIMIT.3 min readSELECT, WHERE, ORDER BY, LIMIT, joins, subqueries in FROM, and table aliases. It also assumes you can read a basic PostgreSQL execution plan.3 min readSELECT, joins, subqueries, ORDER BY, and LIMIT. This chapter compares LATERAL with two common alternatives: window functions and correlated scalar subqueries.3 min read