惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
J
Java Code Geeks
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
人人都是产品经理
人人都是产品经理
博客园 - 【当耐特】
雷峰网
雷峰网
D
DataBreaches.Net
B
Blog RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东
V
Visual Studio Blog
Apple Machine Learning Research
Apple Machine Learning Research
N
Netflix TechBlog - Medium
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta

PostHog's RSS Feed

Training our own AI models - PostHog From 270GB RAM to 5GB: Moving local flag evaluation from Django to Rust The best analytics stack for vibe-coded apps The do's and don'ts of minimum viable product marketing - PostHog The best MCP servers for startups, by workflow 4,063 errors closed without a human opening PostHog – here's what we learned - PostHog PostHog Code and the self-driving product - PostHog Why attacking your competitors online is dumb - PostHog The best real-time analytics platforms for developers, compared DuckDB vs ClickHouse: Why we use both at PostHog - PostHog PostHog's next chapter - PostHog Making Claude Cowork actually useful - PostHog PostHog vs Matomo in-depth tool comparison You're doing lifecycle emails wrong Untangling Tokio and Rayon in production: From 2s latency spikes to 94ms flat The best HIPAA-compliant A/B testing tools - PostHog A beginner's guide to testing AI agents - PostHog I hate the standup bot (so I built an agent to do it for me) - PostHog The best CDPs for developers, compared The best error tracking tools for developers, compared The best feature flag software for developers, compared 7 best session replay tools for mobile apps 7 best free open source business intelligence tools right now 7 best free and open source LLM observability tools PostHog vs LogRocket in-depth tool comparison The most popular PostHog alternatives, compared Open source (and self-hosted) session replay tools - PostHog The 9 best GA4 alternatives for apps and websites - PostHog PostHog vs Google Analytics 4 in-depth tool comparison How we built automatic clustering for LLM traces - PostHog
Introducing HogQL: Direct SQL access for PostHog - PostHog
Joe Martin · 2023-06-08 · via PostHog's RSS Feed

Today, we're releasing a major new feature as a public beta: the ability to directly query your PostHog data using SQL. We call this HogQL because... hedgehogs love SQL, probably?

You can use HogQL expressions to enhance insights, filter event lists, and write full queries to analyze data in any way you want.

PostHog's existing insights are already incredibly powerful. HogQL turns insights Super Saiyan.

HogQL is free for all users of PostHog Cloud while in public beta – all we ask is that you share your feedback with us.

It's a translation layer over ClickHouse SQL. It's intuitive for anyone familiar with SQL, but it offers a few advantages and customizations.

Features unique to HogQL include simplified access to event and person properties, like the autocapture element chain. It also automatically adds joins when you query fields with data on a different table, such as events.person.properties.$browser.

You can also use subqueries, joins, table expressions, arrays, lambdas, and a whole host of other neat SQL features, including aggregations.

See our HogQL documentation for a full list of supported ClickHouse SQL functions.

Not a PostHog user? Get started for free – all users get 1 million events and 5k recordings free every month, no card required.

Too much to list in one blog post, but here are a few examples:

HogQL breakdowns = multiple properties

Want to break down signups by both pricing tier and overall usage? No problem. HogQL does that. With HogQL, you can add as many breakdown properties as you like. Go nuts.

🎓 Related tutorial: Using HogQL for advanced breakdowns

HogQL filters

Oh, look. You can use HogQL in filters too. Useful for filtering by multiple properties!

🎓 Related tutorial Using HogQL for advanced time and date filters

HogQL aggregations

And you can use HogQL to aggregate results in a funnel, too. Is there anything HogQL can't do? Probably, yes, but we'll enjoy finding out for sure.

🎓 Related tutorial The power of HogQL’s sum() aggregation

Custom SQL insights

Of course, the most powerful way to leverage HogQL within PostHog is via the new SQL insight type. This gives you direct SQL access to your data in PostHog, so you can create custom table insights that answer complex questions.

For example, while you can use a retention insight to discover which features keep users coming back for more, you could build an SQL insight to find which users keep coming back, and identify outliers.

We're confident SQL insights will unlock deep analysis into how users use your products, and we can't wait to hear your feedback and see how you use SQL access in PostHog.

To get a flavor, here's an example query summarizing survey data. Its purpose? Determining which countries prefer pineapple on a pizza. This is serious analysis:1

There. Is. Mooooorrrre.

As part of our work on HogQL, we've reworked all our insights as JSON objects, which you can customize. Just click the 'View source' button in the top right (see below), and tweak the code directly.

You can also create custom table insights directly from Activity (previously "Live Events") and Person & Groups tabs.

Just hit that 'Open as a new insight' button (see above), tweak the JSON (if you want), and save your table to a dashboard or notebook.

Moving on... you can also use HogQL expressions (e.g. properties.$screen_width * $properties.screen_height) and aggregations (e.g. sum(properties.price)) as columns. This is helpful not just for generating tables that summarize person and event information, but also for exploring the data in new and totally custom ways.

You could, for example, use HogQL to run currency conversions and normalize data into a single currency in its own column, or even extrapolate and project revenue, and usage figures, into the future.

It started with a small idea and just got bigger.

We originally started thinking about HogQL back in January, while thinking about a concept for universal search within PostHog.

Over time, that plan evolved into creating new ways for users to explore data via direct queries. We wanted to enable to run formulas in what was then called the Live Events view, but is now "Activity."

However, while this work was underway we realized we could potentially take it a step further and build full SQL support directly into PostHog as a new insight type... so we did! It was a short conversation.

We're still actively developing all these ideas, as well as the implementation of HogQL within PostHog – seriously, check out this massive mega issue. This is, as the cliché goes, just the beginning. There's at least 19 more Super Saiyan forms to go... 🔥

Got an opinion on what we should do next? Share it via the feedback modal in PostHog, or let us know on Twitter.

Not a PostHog user? Get started for free – all users get 1 million events and 5k recordings free every month, no card required.

Subscribe to our newsletter

Product for Engineers

Read by 100,000+ founders and builders

We'll share your email with Substack