Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6847095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:42:11+00:00 2026-05-27T00:42:11+00:00

I have a view which is defined as a SELECT bellow. Is there any

  • 0

I have a view which is defined as a SELECT bellow. Is there any way to optimize this? Right now it is very very slow.

SELECT 
    -- lots of columns 
FROM   (((((((((((`table1` `t1`
                  LEFT JOIN `table2` `t2`
                    ON(( `t2`.`userid` = `t1`.`userid` )))
                 LEFT JOIN `table3` `t3`
                   ON(( `t1`.`orderid` = `t3`.`orderid` )))
                LEFT JOIN `table4` `t4`
                  ON(( `t4`.`orderitemlicenseid` =
                     `t3`.`orderitemlicenseid` )))
               LEFT JOIN `table5` `t5`
                 ON(( `t1`.`orderid` = `t5`.`orderid` )))
              LEFT JOIN `table6` `t6`
                ON(( `t5`.`transactionid` = `t6`.`transactionid` )))
             LEFT JOIN `table7` `t7`
               ON(( `t7`.`transactionid` = `t5`.`transactionid` )))
            LEFT JOIN `table8` `t8`
              ON(( `t8`.`voucherid` = `t7`.`voucherid` )))
           LEFT JOIN `table9` `t9`
             ON(( `t8`.`voucherid` = `t9`.`voucherid` )))
          LEFT JOIN `table10` `t10`
            ON(( ( `t10`.`vouchergroupid` = `t9`.`vouchergroupid` )
                 AND ( `t2`.`territoryid` = `t10`.`territoryid` ) )))
         LEFT JOIN `table11` `t11`
           ON(( `t11`.`voucherid` = `t8`.`voucherid` )))
        LEFT JOIN `table12` `t12`
          ON(( `t12`.`orderid` = `t1`.`orderid` )))
GROUP  BY `t5`.`transactionid`

EXPLAIN will return something like:

id  select_type table   type    possible_keys   key key_len ref rows    Extra
1   PRIMARY <derived2>  ALL NULL    NULL    NULL    NULL    11571   
2   DERIVED t1  ALL NULL    NULL    NULL    NULL    11737   "Using temporary; Using filesort"
2   DERIVED t2  eq_ref  PRIMARY PRIMARY 4   database.o.userID   1   
2   DERIVED t3  ref fk_tblOrderItemLicenses_tblOrders1  fk_tblOrderItemLicenses_tblOrders1  4   database.o.orderID  1   
2   DERIVED t4  ref fk_tblOrderItemLicenseRefunds_tblOrderItemLicenses1 fk_tblOrderItemLicenseRefunds_tblOrderItemLicenses1 4   database.oil.orderItemLicenseID 1   "Using index"
2   DERIVED t5  ref fk_tblTransactions_tblOrders1   fk_tblTransactions_tblOrders1   4   database.o.orderID  1   
2   DERIVED t6  ref fk_tblTransactionCardDetails_tblTransactions1   fk_tblTransactionCardDetails_tblTransactions1   4   database.t.transactionID    1   
2   DERIVED t7  ref fk_tblVoucherTransactions_tblTransactions1  fk_tblVoucherTransactions_tblTransactions1  4   database.t.transactionID    1   
2   DERIVED t8  eq_ref  PRIMARY PRIMARY 4   database.vt.voucherID   1   
2   DERIVED t9  ref fk_tblVoucherVoucherGroups_tblVouchers1 fk_tblVoucherVoucherGroups_tblVouchers1 4   database.v.voucherID    1   "Using index"
2   DERIVED t10 eq_ref  PRIMARY PRIMARY 4   database.vvg.voucherGroupID 1   
2   DERIVED t11 ref fk_tblUserVouchers_tblVouchers  fk_tblUserVouchers_tblVouchers  4   database.v.voucherID    1   "Using index"
2   DERIVED t12 ref fk_tblTaiwanInvoiceData_tblOrders1  fk_tblTaiwanInvoiceData_tblOrders1  4   database.o.orderID  1   
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:42:12+00:00Added an answer on May 27, 2026 at 12:42 am

    You could make a “result table” where you insert the result of your query into. You project reads its data from that result tabel. Then you create a job (not sure what the mysql options are) that runs the slow query every hour/day/week to keep the result table up to date.

    furthermore the usual stuff like indexs

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
I have to query a view and include only those columns which are defined
If I have materialized view in Oracle which is defined as REFRESH FAST ON
I have a view which contains a form, the form posts and the data
I have a view which is composed of top, left and bottom headers and
I have a view which was working fine when I was joining my main
I have a view which I built in Interface builder with a tableview and
I have an admin view which contains four foreign keys each with a few
I have a view from which I am selecting three columns. Of these three
I have a FrameLayout view which contains one (MapView-like) control and some additional buttons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.