MariaDB query time in profile not match
Profile shows the (server-side) operating system resource usage by the server process, while the command-line interface reports the (client-side) statement execution elapsed time, which also includes in-client processing and the time spent sending the statement to the server for processing and receiving the results. In other words, elapsed time reported by the CLI is a superset of time measured by the "profiler". The shorter the statement execution time, the higher the proportion of the client overhead in the overall elapsed time.

See also this related question.