#818

Index the customer profile's «last 20 orders»

The customer profile UI loads a «last 20 orders for this customer» panel — filter by customer id and sort by creation date descending with limit 20. Two separate indexes aren't enough: after filtering, Postgres still sorts the result separately. A composite index over both columns at once — customer plus date descending — covers the filter and the sort in a single pass. Build an index named orders_customer_created_idx on orders where the first column is customer_id and the second is created_at in descending order.

Your query result will appear here