My query in which i am taking the sum of customers total paid . i have around 100k invoices for the given customer right now.
My query is taking around 5 to 7 seconds to sum the total payments of given customer . is there any ways to
make it much faster.
MY QUERY
SELECT SUM(total_bill) AS total_bill, SUM(total_paid) as total_paid from stitchit_data_bucket where cus_id = ‘024420000000’ AND type = ‘invoice’
MY INDEX
CREATE INDEX def_cus_id_type
ON stitchit_data_bucket
(cus_id
,type
)
- index - def_cus_id_type
- index_id - 817d4e1db8bf21a4
- index_projection
- primary_key - true
- keyspace - stitchit_data_bucket
- namespace - default
- spans
- exact - true
- range
- high - “024420000000”
- inclusion - 3
- low - “024420000000”
- high - “invoice”
- inclusion - 3
- low - “invoice”
- using - gsi