Skip to content

Order by columns not present in the result? #8896

Answered by gforsyth
ivirshup asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, this was a bit of a journey and thanks to @cpcloud for providing some much-needed clarity on it.

The selected columns gene_tx and tx_id are pairwise unique, so you would expect the output to be consistently ordered. However, the ordering columns seq_name, tx_seq_start, tx_seq_end are not pairwise unique, there are a few overlaps, so the ordering in those overlaps can vary because there's not sufficient information for a deterministic ordering.

To get around that, we can add row numbers before the initial ordering, and then use the row number as the final ordering column to provide a tie-break when the other three columns aren't unique. With that added (below) this query is fully deter…

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
6 replies
@gforsyth
Comment options

@gforsyth
Comment options

@gforsyth
Comment options

@gforsyth
Comment options

@gforsyth
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by gforsyth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants