# X_QUERY_SORT_UNSERVED

## Means

a limited read sorts its rows: no index serves the order

## Typical cause

an order by whose columns no index on the filtered table holds, in that order, after the equality columns

## Fix

`x db gen "index <table> <columns>"` — after indexes: [{ on: ['<orgId>', '<filter column>', '<order column>'] }] in entity('<entity>'); or, for a sort no index holds, a rewrite or `expectedSeqScan('<why>', fn)`

[Testing](/error-codes#testing)
