query taking long time to match

Vineet S 1,070 Reputation points
2024-05-10T13:40:44.6133333+00:00

Hi Team,

how to split the query to check data missmatch fint.eabl column if there multiple left joint and taking time to match it

query attached

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,992 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,591 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,656 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 66,706 Reputation points
    2024-05-10T20:46:17.61+00:00

    when you use a function (substring, ltrim, rtrim, dateadd, etc) on a column in the join or where clause, that value can not be used to index, a scan is done. if the other columns are not very selective, this will cause a table scan and slow the query.

    outer joins are typically slow as its all rows not matching the join.

    note: you should clean up your data and not require trim operations.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.