Hi @Fastbest
Your query statement is not complicated. The reason for the long running time is that the data of the two tables is too large.
As a supplement, you can refer to this document to learn the index.
Best regards,
Percy Tang
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi guys!
I cannot find the tag for t-sql? Hope the tag is correct to get help.
May i know how to run the sql query faster?
Sorry that i cannot share my code. I'm only consult two tables and do inner join, why it takes several minutes to show the result?
Hi @Fastbest
Your query statement is not complicated. The reason for the long running time is that the data of the two tables is too large.
As a supplement, you can refer to this document to learn the index.
Best regards,
Percy Tang
Hi Fastbest,
Its better if you give some detail so experts may help you in a better way.
Generally speaking, if your tables have large amounts of data then you should have indexes on them to optimize queries.
e.g. if you have inner join on 2 columns i.e id ,name then you should create index on id and name.
Hope it helps.
the only way to make a two table join faster is with better indexes. if you look at the query plan, you want an index seek for the first table, and merge join for the second table (with no sort), if low number of result rows a nested index lookup on the second table may be ok depending on the filter.
if the you have any table scans, you need to remove (unless the table is < 1000 rows).