Speeding Up SQL Query: Grouping & Joining

  • Thread starter Thread starter BWV
  • Start date Start date
  • Tags Tags
    Sql
AI Thread Summary
The discussion revolves around optimizing a slow T-SQL query that involves multiple inner joins across several tables. Participants suggest grouping the four category tables into a single table to improve performance, while acknowledging potential permission issues with creating new tables. The conversation highlights the importance of proper indexing and the potential benefits of denormalizing data for faster query execution. Additionally, there are debates about the efficiency of using Python for data manipulation versus relying on the database's built-in optimization capabilities. Ultimately, the consensus is that without restructuring the database or having proper indexing, significant performance improvements may be challenging to achieve.
  • #51
Why not ignore the views and query the table they are formed from? A view is not a real table, so the view has to be created by its own query, and you are doing that several times. then joining them. Query the source of these views directly, so no join is required. However, are the views indexed? The index should be stored. But the index to the table of origin should be stored as well, so querying that should be faster as no join would be required.

Views are usually created to give office staff easy access to just the data their level of expertise or position in a company allows, or to avoid errors when they repeatedly enter a query with an extra column or two being required.
 
Technology news on Phys.org
  • #52
DrJohn said:
Why not ignore the views and query the table they are formed from?
We are going round in circles:
BWV said:
The tables are actually views on a third party app, they are indexed, but I have no ability to alter them
The OP was fully addressed some time ago.
 
Back
Top