I have an application that retrieves large volumes of data from an SQL database that must be sorted by two different columns.
Since most of my queries are SELECT statements and *most* of them use this particular dual-sorted order, this adds quite a load on the server.
My question is this:
Is there a way to statically re-order a table by one or more entries so I do not have to dynamically have it re-ordered?
Is my only option to maintain separate tables (one created as an ordered set of the other) or can I physically modify the primary table to display in sorted order.
it might be important to mention that these tables DO have an AUTO-INCREMENT Key. I"m not sure if that places restrictions on the table or not.
I haven't been able to find much good info on this.
I will be using MySQL but my question applies to Postgre-SQL and other systems.
Thanks in advance!
Eric
Since most of my queries are SELECT statements and *most* of them use this particular dual-sorted order, this adds quite a load on the server.
My question is this:
Is there a way to statically re-order a table by one or more entries so I do not have to dynamically have it re-ordered?
Is my only option to maintain separate tables (one created as an ordered set of the other) or can I physically modify the primary table to display in sorted order.
it might be important to mention that these tables DO have an AUTO-INCREMENT Key. I"m not sure if that places restrictions on the table or not.
I haven't been able to find much good info on this.
I will be using MySQL but my question applies to Postgre-SQL and other systems.
Thanks in advance!
Eric