I found that limit in the web UI seems not behaving as expected.
When I run a query like the follows:
When I specify the limit as 50, the result has 19 records, and when I specify the limit as 500000, there are 90+ records in the result and each record has higher col4 and total_col5.
But for query that doesn't have subquery, the result remains the same no matter how I change the limit.
I guess for the query with subquery, limit somehow limits the number of the result from the inner query instead of the result of the outer query.