12 lines
543 B
MySQL
12 lines
543 B
MySQL
|
|
-- Speed up the subscription-like invoice line classifier and company filters.
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_mc_items_subscription_visibility
|
||
|
|
ON migration_center_session_items
|
||
|
|
(session_id, source_system, entity_type, customer_no, product_code, invoice_date);
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_mc_items_company_name
|
||
|
|
ON migration_center_session_items (session_id, LOWER(customer_name));
|
||
|
|
|
||
|
|
CREATE INDEX IF NOT EXISTS idx_sag_subscriptions_customer_price
|
||
|
|
ON sag_subscriptions (customer_id, price)
|
||
|
|
WHERE status <> 'cancelled';
|