encode / django-rest-framework

Web APIs for Django. 🎸
https://www.django-rest-framework.org
Other
27.83k stars 6.76k forks source link

Revert "Ensure CursorPagination respects nulls in the ordering field" #9381

Closed max-muoto closed 2 months ago

max-muoto commented 2 months ago

As @kylebebak has mentioned in https://github.com/encode/django-rest-framework/issues/9359 attempting to accounting for nulls in the ordering field can lead to a serious performance regression in Postgres due to an index not being hit on the second query. This is blocking upgrades for some to 3.15, so putting out this PR to revert the changes. As he mentioned, it's a pretty uncommon use-case for the ordering field to be null, in the mean-time a reasonable work around would be using some sentinel value to ensure the items come last, or simply not using a nullable column.