Hi, I use SQL hint to set statet ttl ``` SELECT /*...
# troubleshooting
a
Hi, I use SQL hint to set statet ttl
Copy code
SELECT /*+ STATE_TTL('session'='12h', 'userState'='1d', 'authorizedUserState'='365d') */
it looks like it is not working, do anybody have any idea what it can happend?
g
There are some limitations to hints. Make sure you read the “note” section of the documentation for state ttl and see if your case doesn’t fall into one of those. Specifically the first one is often a common issue.
a
Copy code
SELECT /*+ STATE_TTL('session'='12h', 'userState'='1d', 'authorizedUserState'='365d') */" +
                " action.uuid," +
                " action.client_id, action.user_uuid, action.stream_uuid," +
                " action.name," +
                " action.location, action.source, action.exp_uid, action.exp_branch," +
                " action.attributes," +
                " action.event_time," +
                " action.product," +

                " session.session_uuid, session.type, session.`language`, session.time_zone," +
                " session.browser, session.os, session.platform, session.ref_host, session.source as session_source," +
                " session.geo.country as geo_country, session.geo.country_code as geo_country_code," +
                " session.geo.continent as geo_continent, session.geo.region as geo_region, session.geo.`group` as geo_group," +
                " session.device_model, session.device, " +

                " CASE " +
                "   WHEN authorizedUserState.user_id IS NOT NULL THEN authorizedUserState.user_state_uuid " +
                "   ELSE userState.user_state_uuid END AS user_state_uuid," +

                " action.user_id, " +

                " CASE " +
                "   WHEN authorizedUserState.user_id IS NOT NULL THEN authorizedUserState.auth_status" +
                "   ELSE userState.auth_status END AS auth_status," +

                " CASE " +
                "   WHEN authorizedUserState.user_id IS NOT NULL THEN authorizedUserState.paid_status" +
                "   ELSE userState.paid_status END AS paid_status," +

                " CASE " +
                "   WHEN authorizedUserState.user_id IS NOT NULL THEN authorizedUserState.subscription_id" +
                "   ELSE userState.subscription_id END AS subscription_id," +

                " CASE " +
                "   WHEN authorizedUserState.user_id IS NOT NULL THEN authorizedUserState.business_type" +
                "   ELSE userState.business_type END AS business_type," +

                " CASE " +
                "   WHEN authorizedUserState.user_id IS NOT NULL THEN authorizedUserState.organization_role" +
                "   ELSE userState.organization_role END AS organization_role" +

                " FROM Actions action " +
                " JOIN Sessions FOR SYSTEM_TIME AS OF action.ingestion_time AS session ON action.stream_uuid = session.stream_uuid " +
                " LEFT JOIN UserStates FOR SYSTEM_TIME AS OF action.ingestion_time AS userState ON action.user_id = userState.user_id " +
                " LEFT JOIN AuthorizedUserStates FOR SYSTEM_TIME AS OF action.ingestion_time AS authorizedUserState ON action.user_id = authorizedUserState.user_id"
it’s my SQL code. i don’t see that anything can affect me