Query optimize on large database
Hey guys! I'got table with 300kk rows and ~40 GB size
It got simple structure like [owner_id, Artist, Title] (user's songs list)
My task is simple - need to select the number of matches user's Artist+Title pair (songs) with specified @user_id and display it like [user_id:number_of_matches with specified @user_id]
Got query like that:
SELECT d2.owner_id, COUNT(*) AS kolvo
FROM data d1
JOIN data d2 USING(Artist,Title)
WHERE d1.owner_id = @user_id
GROUP BY d1.owner_id
Got indexes [Artist,Title] and [owner_id]
But the bigger table becomes the more time it takes to execute query...
At first it was pretty fast but now it takes around 1 minute to finish.
Any ideas how to optimize my task? Thanks a lot!
Subject
Views
Written By
Posted
Query optimize on large database
1605
July 13, 2016 01:40AM
972
July 15, 2016 05:12PM
947
July 16, 2016 04:15AM
927
July 16, 2016 12:09PM
949
July 16, 2016 12:36PM
895
July 16, 2016 02:46PM
968
July 17, 2016 11:22AM
920
July 18, 2016 04:28AM
892
July 18, 2016 08:40AM
871
July 20, 2016 04:46AM
933
July 20, 2016 08:06AM
915
July 20, 2016 09:29AM
915
July 21, 2016 04:35AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.