Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order by #48

Closed
ghenry opened this issue Oct 31, 2023 · 2 comments
Closed

order by #48

ghenry opened this issue Oct 31, 2023 · 2 comments

Comments

@ghenry
Copy link

ghenry commented Oct 31, 2023

Hi all,

I presume I can't order by in Pg as the data is encrypted and Pg doesn't know what it is?

Thanks.

@KristerV
Copy link

correct. got to order after DB query and if performance is an issue have a cache.

@danielberkompas
Copy link
Owner

Yes, this is correct. If order is important, I would suggest having an unencrypted field that contains some kind of sortable information that won't reveal the nature of the plaintext.

For example, if you wanted to sort by an encrypted "created at" field, you could add a new auto-incrementing integer field to the database table and sort by that. The auto-increment would ensure that rows with more recent created_at dates have a higher number than older ones, without revealing the exact dates.

@danielberkompas danielberkompas closed this as not planned Won't fix, can't repro, duplicate, stale Apr 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants