How to make quick unique sample of postgresql?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
14 views
There is a table:
5aeb6e34b9733865091734.png
You need to quickly get from the table for the latest unique values for a field "radio".
That is, for the field "radio" is the last value the value of the field "track".

Digging on the Internet found only this:5aeb701994ca0004359774.png
But he performed 5 min, which is not very good.

I would be grateful for any advice
by | 14 views

2 Answers

0 like 0 dislike
select * from tracks group by radio;
by
0 like 0 dislike
A list of needed radio have separately or should we look for on this label?
If you look on the same plate - you will need a loose index scan. Stupid scheduler itself does not do that, we need to explain manually.
If the list is separate, a simple lateral join of the subquery will be more compact.
Here from 30 to 46 slides

The necessary index btree(radio, date) if I correctly understand on what basis you want to define "last" value.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
110,608 questions
257,187 answers
0 comments
40,796 users