0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
posthog/ee/clickhouse
Eric Duong a0ab699588
Proper interval rounding on normal trends (#2901)
* do proper interval rounding on normal trends

* patch inconsistency

* remove microseconds

* conditionall round interval

* adjust how date_from is handled

* add retention test

* edits and split test
2021-01-13 14:35:46 +01:00
..
migrations MV -> View for events_with_array_props_view and remove EVENT_PROP_TABLE_SQL (#2766) 2020-12-15 10:59:28 -08:00
models Fix REST hook firing (#2894) 2021-01-12 13:09:27 +01:00
queries Proper interval rounding on normal trends (#2901) 2021-01-13 14:35:46 +01:00
sql Allow going from insights -> sessions (on cloud) (#2790) 2021-01-06 12:59:52 +02:00
test Clickhouse caching (#2855) 2021-01-06 22:37:43 +01:00
views Fix REST hook firing (#2894) 2021-01-12 13:09:27 +01:00
__init__.py
clickhouse_test_runner.py
client.py Cleaned up system status page (#2682) 2020-12-09 13:57:12 +01:00
demo.py Zapier updates (#2686) 2020-12-07 16:29:58 +01:00
middleware.py Debug CH queries (#2666) 2020-12-07 16:06:14 +01:00
process_event.py Fix REST hook firing (#2894) 2021-01-12 13:09:27 +01:00
README.md
util.py MV -> View for events_with_array_props_view and remove EVENT_PROP_TABLE_SQL (#2766) 2020-12-15 10:59:28 -08:00

Clickhouse Support (Enterprise Feature)

To accomodate high volume deployments, Posthog can use Clickhouse instead of Postgres. Clickhouse isn't used by default because Postgres is easier to deploy and maintain on smaller instances and on platforms such as Heroku.

Clickhouse Support works by swapping in separate queries and classes in the system for models that are most impacted by high volume usage (ex: events and actions).

Migrations and Models

The django_clickhouse orm is used to manage migrations and models. The ORM is used to mimic the django model and migration structure in the main folder.

Queries

Queries parallel the queries folder in the main folder however, clickhouse queries are written in SQL and do not utilize the ORM.

Tests

The tests are inherited from the main folder. The Clickhouse query classes are based off BaseQuery so their run function should work just as the Django ORM backed query classes. These classes are called with the paramterized tests declared in the main folder which allows the same suite of tests to be run with different implementations.

Views

Views contain Viewset classes that are not backed by models. Instead the views query Clickhouse tables using SQL. These views match the interface provide by the views in the main folder.