Home > database >  Have a great god can better optimization Suggestions, query time now probably around 10 seconds
Have a great god can better optimization Suggestions, query time now probably around 10 seconds

Time:10-03


Have a great god can better optimization Suggestions, probably around 10 seconds, query time now indexes have joined
(
SELECT
` payments_total `. ` pay_type `,
` payments_total `. ` store_id `,
The SUM (
Billing_details. Import_money
) AS sum_import_money,
The SUM (
Billing_details. Explode_money
) AS sum_explode_money,
The SUM (
Billing_details. Service_money
) AS sum_service_money,
` member `. ` name `
The FROM
` billing_details `
INNER JOIN ` payments_total ` ON payments_total. Payment_id=billing_details. Payment_id
INNER JOIN ` member ` ON member, shop_Id=billing_details. Store_id
WHERE
Payments_total. ` status `='succ'
AND billing_details. ` status `=1
AND payments_total. Disabled='false'
AND billing_details. Disabled='false'
AND payments_total. Trade_code IN (
'3021',
'3030',
'3031',
'3026',
'3027',
'3028'
)
GROUP BY
` payments_total `. ` store_id `
The ORDER BY
` billing_details `. ` t_time ` DESC
)
The UNION
(
SELECT
` payments_total `. ` pay_type `,
` payments_total `. ` store_id `,
The SUM (
Billing_details. Import_money
) AS sum_import_money,
The SUM (
Billing_details. Explode_money
) AS su (
SELECT
` payments_total `. ` pay_type `,
` payments_total `. ` store_id `,
The SUM (
Billing_details. Import_money
) AS sum_import_money,
The SUM (
Billing_details. Explode_money
) AS sum_explode_money,
The SUM (
Billing_details. Service_money
) AS sum_service_money,
` member `. ` name `
The FROM
` billing_details `
INNER JOIN ` payments_total ` ON payments_total. Payment_id=billing_details. Payment_id
INNER JOIN ` member ` ON member, shop_Id=billing_details. Store_id
WHERE
Payments_total. ` status `='succ'
AND billing_details. ` status `=1
AND payments_total. Disabled='false'
AND billing_details. Disabled='false'
AND payments_total. Trade_code IN (
'3021',
'3030',
'3031',
'3026',
'3027',
'3028'
)
GROUP BY
` payments_total `. ` store_id `
The ORDER BY
` billing_details `. ` t_time ` DESC
)
The UNION
(
SELECT
` payments_total `. ` pay_type `,
` payments_total `. ` store_id `,
The SUM (
Billing_details. Import_money
) AS sum_import_money,
The SUM (
Billing_details. Explode_money
) AS sum_explode_money,
The SUM (
Billing_details. Service_money
) AS sum_service_money,
` member `. ` name `
The FROM
` billing_details `
INNER JOIN ` payments_total ` ON payments_total. Payment_id=billing_details. Payment_id
INNER JOIN ` member ` ON member, shop_Id=billing_details. Store_id
WHERE
Payments_total. ` status `='succ'
AND billing_details. ` status `=1
AND payments_total. Disabled='false'
AND billing_details. Disabled='false'
AND payments_total. Trade_code IN (
'3041',
'3042',
'3043',
'3044',
'3045',
'3046'
)
GROUP BY
` payments_total `. ` store_id `
The ORDER BY
` billing_details `. ` t_time ` DESC
) m_explode_money,
The SUM (
Billing_details. Service_money
) AS sum_service_money,
` member `. ` name `
The FROM
` billing_details `
INNER JOIN ` payments_total ` ON payments_total. Payment_id=billing_details. Payment_id
INNER JOIN ` member ` ON member, shop_Id=billing_details. Store_id
WHERE
Payments_total. ` status `='succ'
AND billing_details. ` status `=1
AND payments_total. Disabled='false'
AND billing_details. Disabled='false'
AND payments_total. Trade_code IN (
'3041',
'3042',
'3043',
'3044',
'3045',
'3046'
)
GROUP BY
` payments_total `. ` store_id `
The ORDER BY
` billing_details `. ` t_time ` DESC
)
  • Related