Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3585

Re: Does "ORDER BY PRIMARY KEY" make any sense inside SELECT..ENDSELECT in HANA?

$
0
0

Hi Alexander,

 

from my understanding of the columnstore and the "ORDER BY PRIMARY KEY" is as follows:

 

Order by Primary Key, does not sort the results, it fetches the data sorted as they are sorted on the database according to the primary key, if the database is sorting the table, if not, the results are sorted according to the primary keys.

 

As a database using columnstore you can not just fetch the data and have them sorted by primary key, so the openSQL syntax is probably emulated and so the results are sorted.

 

TL:DR on HANA the ORDER BY PRIMARY KEY should not be faster than a manual ORDER BY "keys" due to emulation

 

You can also read the following link for general information.

 

Specifying a Sort Order - ABAP Programming (BC-ABA) - SAP Library


Viewing all articles
Browse latest Browse all 3585

Trending Articles