i tried to find an answer for my question in this forum and in others, but unfortunaly i did not found the best solution.
I have a table in MSSQL with around 20 columns.
Currently there is a primary index on an ID field. The table has around 1 million rows and i need to show them on an frontend. Therefore i wrote a simply sql script with an order by at the end
(order by column1, column2, column3 desc)
Unfortunaly this 3 order by slow down the statement and instead of 1 second it needs around 40 seconds to show the result. I assuming i need to create an index on this 3 columns(primary key field ID is not part of it)
What`s the best index typ to use here? Mainly there are 3 columns where the ordering will be done and without them the data is usless, on the other side the users can not wait 40 seconds till they get an result. I found many different index types, but i absolut don`t know what i need to use to speed up the query.
Sorry if i ask a stupid question for some of you here, i unfortunaly know nothing about indexing on sql and the documentation did not really help me.