Feb 10, 2021

ClickHouse tips #2: Debugging ClickHouse on Visual Studio Code

How to configure Visual Studio Code to debug ClickHouse on it.
Alberto Romeu
Backend Developer

Want to stay updated?
Register for the Tinybird newsletter.

It’s possible to debug ClickHouse on VSCode. These are the steps to do it:

  • Build ClickHouse for debugging docs
  • You can adapt the build with several flags, in my case I want to disable jemalloc:
  • Doing ninja clickhouse-server clickhouse-client the whole process takes less than one hour.

And then to debug with Visual Studio Code:

  • Install the C++ extension (and gdb from brew or apt)
  • Create a new run config like this in .vscode:

Then you can just add breakpoints in any line in the editor and RUN from inside Visual Studio Code.

After doing any change in a cpp file, you can just recompile it, although there might be better ways to do this (let us know!). There’s a compile_commands.json file in the build folder with the commands and then call ninja to re-generate the clickhouse binary (it’ll just recompile the dependencies)

That’s it!

Want to stay updated?
Register for the Tinybird newsletter.

Do you like this post?

Related posts

I built a Tinybird syntax highlighter for VSCode
We have released a stable version of the Tinybird CLI
How to analyze usage from your MCP Server
Ship data as you ship code: Tinybird is becoming local-first.
We added the Backup Database engine to ClickHouse
Changelog: Workspaces, Node UI improvements and more

Tinybird

Team

Feb 17, 2021
How we cut our CI pipeline execution time in half

Tinybird

Team

Feb 17, 2023
Experimental ClickHouse: Projections
Changelog #21: Quickstart on loading events to Tinybird
Building a faster CI pipeline with Turborepo and pnpm

Build fast data products, faster.

Try Tinybird and bring your data sources together and enable engineers to build with data in minutes. No credit card required, free to get started.
Tinybird is not affiliated with, associated with, or sponsored by ClickHouse, Inc. ClickHouse® is a registered trademark of ClickHouse, Inc.