ClickHouse tips #11: Best way to get query types
![](https://cdn.prod.website-files.com/604a2f667b2fcefbc095bfc8/622b1a762d58c48f7811d708_SXxHaLe9_400x400.jpg)
![](https://cdn.prod.website-files.com/604a2f667b2fcefbc095bfc8/6256eed5bb85145fe41034aa_62562e34d70d933f883000c1_tips-11-how-to-get-the-types-returned-by-a-query-large.jpeg)
There are situations when we might want to retrieve the type of a query, function, aggregation, etc in ClickHouse. This information could be really important when we want to identify and debug an issue.
Checking in the docs of ClickHouse, it seems like using {% code-line %}toTypeName(x){% code-line-end %} would provide all that we need.
But there is a catch. For {% code-line %}toTypeName(x){% code-line-end %} to return the type, first, it will need to execute the query. This can lead to a long response time and we might get duplicated results that we do not care about like in the following example.
So, can we find a better solution? Yes, using {% code-line %}DESCRIBE{% code-line-end %}.
{% code-line %}DESCRIBE{% code-line-end %} will return the type after evaluating the query, without execution, and will return only one entry per column. Resulting in an incredible performance boost and more simple solution