goldcougar wrote:The order of the columns in the SELECT doesn't matter. All the DB engines I've used (SQL Server, MySQL, Postgres) are smart enough to use your index regardless of order (as long as all the pk columns are part of the query), and regardless of how you created the index (like most selective column first). So Servoy issues the queries Alphabetical first, your database sees all the PK columns are in the SELECT, and will use your index, which hopefully you've created to be most optimal.
The only real performance issue would be if you also tried to use them in a different order in the ORDER BY portion of the query, then it wouldn't likely be able to use the index.
ROCLASI wrote:goldcougar wrote:The order of the columns in the SELECT doesn't matter. All the DB engines I've used (SQL Server, MySQL, Postgres) are smart enough to use your index regardless of order (as long as all the pk columns are part of the query), and regardless of how you created the index (like most selective column first). So Servoy issues the queries Alphabetical first, your database sees all the PK columns are in the SELECT, and will use your index, which hopefully you've created to be most optimal.
The only real performance issue would be if you also tried to use them in a different order in the ORDER BY portion of the query, then it wouldn't likely be able to use the index.
This is correct. And I think this also answers Robert Huber's original question.
I.e. just create the index how the database wants it, as long as Servoy is querying all the keys (in any order) this will work out fine. Using indexes for sorting does require the correct order.
Users browsing this forum: No registered users and 9 guests