Skip to content

Add this week in Databend 43 #3295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2022
Merged

Add this week in Databend 43 #3295

merged 2 commits into from
May 26, 2022

Conversation

PsiACE
Copy link
Contributor

@PsiACE PsiACE commented May 26, 2022

Ty!


Do Conversion Funnel Analysis With Databend

Funnel analysis measures the number of unique users who has performed a set of actions, and we use it to see drop-off and conversion in multi-step processes.

Create a Table

CREATE TABLE events(user_id BIGINT, event_name VARCHAR, event_timestamp TIMESTAMP);

Now we have a table with the following fields:

  • user_id - a unique identifier for user
  • event_name - type of the event, like: login, visit, cart and purchase
  • event_timestamp - timestamp which event occurred

Funnel Analysis

It's easy and performance to use Databend WINDOW_FUNNEL Function to find out how far the user user_id could get through the chain in an hour window slides.

SELECT
    level,
    count() AS count
FROM
(
    SELECT
        user_id,
        window_funnel(3600000000)(event_timestamp, 
        event_name = 'login', event_name = 'visit', 
        event_name = 'cart', event_name = 'purchase') AS level
    FROM events
    GROUP BY user_id
)
GROUP BY level ORDER BY level ASC;

Learn more:

Copy link
Contributor

@nellshamrell nellshamrell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ty!

@nellshamrell nellshamrell merged commit d3c537c into rust-lang:master May 26, 2022
@PsiACE PsiACE deleted the patch-7 branch May 26, 2022 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants