Hello, Schema:
- PUBLIC.GATABLE2.CUSTOMER_ID PUBLIC.GATABLE2.DT PUBLIC.GATABLE2.CATEGORY_ID PUBLIC.GATABLE2.VERTICAL_ID PUBLIC.GATABLE2.SERVICE PUBLIC.GATABLE2.PRODUCT_VIEWS_APP PUBLIC.GATABLE2.PRODUCT_CLICKS_APP PUBLIC.GATABLE2.PRODUCT_VIEWS_WEB PUBLIC.GATABLE2.PRODUCT_CLICKS_WEB PUBLIC.GATABLE2.PDP_SESSIONS_APP PUBLIC.GATABLE2.PDP_SESSIONS_WEB - pkey = customer_id,dt - affinityKey = customer Query: - select COUNT(*) FROM( Select customer_id from GATABLE2 where category_id in (175925, 101450, 9005, 175930, 175930, 175940,175945,101450, 6453) group by customer_id having SUM(product_views_app) > 2 OR SUM(product_clicks_app) > 1 ) The table has 600M rows. At first, the query took 1m, when we added an index on category_id the query started taking 3m. The SQL execution plan for both queries is attached. We are using a single x1.16xlarge insntace with query parallelism set to 32 Cheers, Eugene
QueryWithoutIndex
Description: Binary data
QueryWithIndex
Description: Binary data
