railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.89k stars 2.26k forks source link

Add primary_key to the end of order #3548

Closed gogutan closed 1 year ago

gogutan commented 2 years ago

When I use rails_admin with PostgreSQL(latest 14.4), it is unstable to order by columns which are not unique. Therefore, some records appear in several pages while some don't in any pages. I would like to solve this problem by adding its primary_key to the end of order.

Before

Player___Dummy_App_Admin Player___Dummy_App_Admin

After

Player___Dummy_App_Admin Player___Dummy_App_Admin

jdufresne commented 1 year ago

I think this would be a good change. Could you investigate the failures?

mshibuya commented 1 year ago

I'm not a fan of this change. Sorting data is a heavy operation for RDBMSs, and doing this will always add an extra sorting, including cases that have stable order. A better option will be supporting ordering by multiple columns, so a user can choose to add an extra sorting when needed.

jdufresne commented 1 year ago

Thanks, I'm convinced. I like your better option proposal!

gogutan commented 1 year ago

I'm sorry for leaving some failures for a while, and thank you for your alternative solution! Although I close this PR, hopefully I will try to make other PRs in future!