I have an import between two linked servers. I basically got to get data from multiple joins to a table on my side.
The current query looks something like this:
select a.* from db1.dbo.tbl1 a inner join db1.dbo.tbl2 on ... inner join db1.dbo.tbl3 on ... inner join db1.dbo.tbl4 on ... inner join db2.dbo.myside on ...
db1 = linked server
db2 = my own database
After that, I use the insert in + select to add this data to my table, which is in db2. (usually several hundred records - this import works once a minute)
My question is about performance. The tables on the linked server (tbl1, tbl2, tbl3, tbl4) are huge tables with millions of records and slow down the import process. I was told that if I join the "other" side (db1 is a connected server), for example, in a stored procedure, than even if the request looks the same, it will work faster. It is right? This is pretty hard to verify. Please note that the connection also contains a table from my database.
Moreover. Are there any other โtricksโ that I could use to speed up this launch? Thanks
source share