The query with ORDER BY and LIMIT is highly optimized, especially when using the designated timestamp. Data in questdb tables is physically stored sorted by incremental timestamp, so we can efficiently retrieve the most recent entry.
The last aggregation function is internally treated as a GROUP BY, so it needs to do a full scan to get the last value. At the moment QuestDB has no optimisations for no-op cases (i.e. when there is no meaningful aggregation). For those queries, you are better off rewriting with an alternative like you did.
By the way, QuestDB accepts a negative limit, so you can do
SELECT timestamp FROM <table_name> LIMIT -1
To access the last row, as data is sorted by incremental designated timestamp.