3 ms·
Why can't postgres just get it's data in a pre-sorted way tho?
by sophacles 4y ago
Why can't postgres just get it's data in a pre-sorted way tho?
- jstimpfle 4y agoOnly the least technical among many possible reasons: it cannot know in advance the row ordering that is requested by the user.
- sicp-enjoyer 4y agoStable sort and binary search is the bread and butter of pretty much every database operation. When you bulk insert into indexed columns, it sorts the inserted data and merges that with the existing index. If you do joins on non-indexed columns it often sorts the intermediate results.