java - how group by having limit works -


can explain how construction group + having + limit work? mysql query:

    select         id,         avg(sal)             streamdata              ...     group         id      having         avg(sal)>=10.0          , avg(sal)<=50.0        limit 100 

query without limit , having clauses executes 7 seconds, limit - instantly if condition covers large amount of data or ~7 seconds otherwise. documentation says limit executes after having after group by, means query should execute ~7 seconds. please figure out limited limit clause.

using limit 100 tells mysql return first 100 records result set. assuming measuring query time round trip java, 1 component of query time network time needed move result set mysql across network. can take considerable time large result set, , using limit 100 should reduce time 0 or near zero.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -