## Bug description

Currently, decide endpoint takes 10+ seconds on kea.js.org.

This means that for first-time visitors autocapture nor session recording will be turned on for that long - losing valuable information.

When measuring this yesterday via shell ([slack thread](https://posthog.slack.com/archives/C0113360FFV/p1604951621008400)), the culprit was feature flags cohort checking. In this case, the cohort user was checked against was defined against the following action:

![Screenshot from 2020-11-10 11-41-32](https://user-images.githubusercontent.com/148820/98657215-49582e80-234a-11eb-9669-37d55e0d23bd.png)

Which currently looks through events of the data for that team.

## Expected behavior

Decide endpoint should use cached/materialized cohort ownership rather than calculating it on the fly.

## How to reproduce

1. Create an action with some selector
2. Create a cohort for has done action at any point
3. Create a feature flag using the cohort.
4. Measure /decide endpoint latency

## Environment

Cloud 

## Additional context

cc @EDsCODE who made it not time out by https://github.com/PostHog/posthog/pull/2299

#### *Thank you* for your bug report – we love squashing them!
ee/clickhouse/models/cohort.py
filters = []
    params: Dict[str, Any] = {}
    for group_idx, group in enumerate(cohort.groups):
        if group.get("action_id"):
            action = Action.objects.get(pk=group["action_id"], team_id=cohort.team.pk)
            action_filter_query, action_params = format_action_filter(action)
            extract_person = "SELECT distinct_id FROM events WHERE team_id = %(team_id)s AND {query}".format(
                query=action_filter_query
            )
            params = {**params, **action_params}
            filters.append("distinct_id IN (" + extract_person + ")")
        elif group.get("properties"):
            from ee.clickhouse.models.property import prop_filter_json_extract
            filter = Filter(data=group)
            query = ""
            for idx, prop in enumerate(filter.properties):
                filter_query, filter_params = prop_filter_json_extract(
                    prop=prop, idx=idx, prepend="{}_{}_{}_person".format(cohort.pk, group_idx, idx)
                )
                params = {**params, **filter_params}
                query += " {}".format(filter_query)
            filters.append("person_id IN {}".format(GET_LATEST_PERSON_ID_SQL.format(query=query)))
    joined_filter = " OR ".join(filters)
    return joined_filter, params
def format_filter_query(cohort: Cohort) -> Tuple[str, Dict[str, Any]]:
    person_query, params = format_person_query(cohort)
    person_id_query = CALCULATE_COHORT_PEOPLE_SQL.format(query=person_query)
    return person_id_query, params