SELECT * FROM table_1 ORDER BY time;
The above query will query all rows sitting in table_1, while sorting all the rows by a column time. However, if the size of the table gets millions of rows, fetching all rows in a table will be inefficient with the addition of ORDER BY time. However luckily, the table I have is a time-series table that uses TimescaleDB extension, and all rows are inserted in timely order.
In this case, what would be the most efficient way of fetching everything in a table, while ensuring the resulting query is ordered by time?
Do I just delete ORDER BY time? If I remove this, can I be sure that the resulting query will ALWAYS be in a order of time?
Also, I've heard that PostgreSQL has some driver issues when fetching all rows in a table, because its optimized for querying small fraction of data in a table. How can I optimize the performance?