I've red your messages.
I'm today also works on embedded platforms ARM/ARC
, firmware engineer.
I have experience in building and porting GNU compiler, developing data base, wrote several programs that uses Lite SQL (previous job as GUI developer). The speed of SELECT with ORDER must be carefully rechecked, I don't beleive, it works so slowely, it have to be other reason.
P.S. Maby those days I will find some time to investigate this.
P.P.S. After looking in global data base creation code I found only one index on file+ directory, so this mean that all sorting done thru creating temporary files or memory, that greatly down speed, the problem not in SQL but rather in usage of SQL. IFAIK we can add indexes on default globaldb and metadata.db, and even on existings global.db to speed up SELECT query