Search code examples
performanceformattingsinglestore

memsql - Formatted Query takes more time than Unformatted query


Why Does Formatted Query takes more time than Unformatted query ? Also Note I have ran the queries many times (So plan caching is taken in account)

Does it mean memsql is poor in query format handling ?

For instance I tried the following query(unformatted)

select count(*) from users where users.rep > 5;
+----------+
| count(*) |
+----------+
|      589 |
+----------+
1 row in set (0.01 sec)

But amazingly the same query when is formatted takes more time

SELECT
  COUNT(*)
FROM
  users
WHERE
  users.rep > 5 ;
+----------+
| count(*) |
+----------+
|      589 |
+----------+
1 row in set (1.39 sec)

Solution

  • With memsql, you have to wait for code compilation the first time you run a query, and the formatted query is considered "a different query" than the unformatted one. Whitespace matters! Try running the formatted version again.

    In general, MemSQL queries are fast only the second time you run them.
    See http://docs.memsql.com/4.0/concepts/codegen/