6 ms·
Nice tips. I'm interested in https://sqlfordevs.com/sorted-table-faster-range-scan https://sqlfordevs.com/sorted-table-faster-range-scan Would you use this appr
by auct 4y ago
Nice tips.
I'm interested in https://sqlfordevs.com/sorted-table-faster-range-scan https://sqlfordevs.com/sorted-table-faster-range-scan
Would you use this approach for something like:
1) movie_actors (movie_id, actor_id, order_index)
2) movie_watchlist (movie_id, user_id, created_at)
3) movie_ratings (movie_id, user_id, rating, created_at)
I know strange question, but most guides suggest all these table should have autoincrement id column
- tpetry 4y agoThese index choices are solid. But I suggest for the second one to swap the movie_id and user_id because in most cases you want to get all the watchlist entries for a user and not all users having the movie on the watchlist. Therefore all movies on a users watchlist are close to each other and not spread through the whole table by the movie_id.