Платежи по заказу

Платежи по заказу

Карточка заказа тянет его платежи. Заказ один, платежей у него единицы — а таблица платежей читается целиком. Здесь снова внешний ключ без индекса. Постройте дорогу от заказа к его платежам.

Speed this query up with an index
SELECT p.* FROM payments p WHERE p.order_id = 77123

Just CREATE/ALTER/DROP — no trailing SELECT needed.

What counts as solved

You may only change the schema: indexes and ANALYZE. The query stays as the task wrote it — no need to send it back.

  • the plan has no Seq Scan on payments
  • the query reads at most 8 8 KB pages

Grading runs on a larger dataset than the samples show — the answer has to hold at scale.

PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid