0
我想要獲取每個用戶的最後一個條目,但是customer_id是散列'ASAG#...'order by customer_id銷燬查詢。有其他選擇嗎?爲postgres中的每個用戶選擇一個項目的最後一個
Select Distinct On (l.customer_id)
l.customer_id
,l.created_at
,l.text
From likes l
Order By l.customer_id, l.created_at Desc
是啊,這是偉大的。有關如何加速的建議?現在大約需要30秒。 –
嘗試在'customer_id'和'created_at'上添加複合索引。 –