N1ql query index performance improvement

Hello

Can we improve the indexes of this query current i am just using date and type for the indexes but the trans_source for the invoices that i have in my bucket is very important so i want to figure out if there is any way to improve the index for this query

SELECT
inv.date,
inv.id,
inv.store_id,
inv.description,
inv.cus_id,
inv.total_after_disc,
inv.total_bill,
inv.tax_amount_price,
inv.employee_id,
inv.account_type,
inv.invoice_taxes,
ins.service_id,
ins.service_name,
inst.department_id,
inst.department_name,
inst.item_id,
inst.item_qty,
inp.payment_type
FROM st_data_bucket inv UNNEST inv.invoice_services ins
UNNEST ins.item_list inst
LEFT UNNEST inv.invoice_payment inp
WHERE inv.date between '2022-08-01' AND  '2022-08-30' AND inv.type = 'invoice' AND inp.trans_source = "invoice"

Current the index is

CREATE INDEX def_net_suite_date_invoice ON st_data_bucket(date) WHERE type = 'invoice'

Above one is optimal

1 Like