Search code examples
cloudyandexydb

Yandex DB: How can I see top queries by CPU time spent?


I am working with YDB (Yandex database) and need to select top CPU time spent queries. How can I get them? Thanks in advance.

I was looking into documentation but failed to find the answer. I am a rookie in cloud systems like that.


Solution

  • You can select top CPU queries with the code like this:

    SELECT
        IntervalEnd,
        CPUTime,
        QueryText
    FROM `.sys/top_queries_by_cpu_time_one_minute`
    ORDER BY IntervalEnd DESC, CPUTime DESC
    LIMIT 100