postgres · console

Replica · read-only Writes go through approval
SELECT m.name AS merchant,
       count(*) AS paid_orders,
       sum(o.total_aed) AS gmv_aed
FROM orders o JOIN merchants m ON m.id = o.merchant_id
WHERE o.status = 'paid' AND o.created_at >= current_date
GROUP BY m.name ORDER BY paid_orders DESC LIMIT 5;
5 rows · 38 ms · uses index_orders_on_merchant_id_and_status
merchant paid_orders gmv_aed
Dar Al Oud 1,284 412,300
Bateel Gifts 1,102 338,910
Saffron Kitchen 944 96,420
Liwa Dates 871 120,775
Corniche Books 603 41,180
↑↓ move↵ run⌘↵ ask Pilot