I'm trying to make simple pagination using Slick with Postgres, but it does not work as expected.
// Table
// "users_pkey" PRIMARY KEY, btree (id)
// "users_id_idx" btree (id)
val id: Column[Option[Long]] = column("id", O.PrimaryKey, O.AutoInc, O.DBType(BigSerial))
// Pagination queries
users.drop(0).take(20).sortBy(_.id.desc).list
users.drop(20).take(20).sortBy(_.id.desc).list
But results are not ordered as expected. Users ordered by id
on inside page, e.g. first page will be like 40, 35, 34 ... 4, 2
and second 39, 38, 36, ... 3, 1
.