August 1, 2007 at 9:01 am
When I have to query the other database, I ofter use OPENQUERY to get the data. My new boss insists me using linked server. I proved to him, using OPENQUERY is faster than linked server but he would not hear it.
I want to know if OPENQUERY and Linked server, which one is better?
August 1, 2007 at 9:19 am
Here is my penny.
For the security: OPENQUERY is better.
For performance: I cannot see why necessarity of using OPENQUERY is faster than using linked server. Their only difference is the first one runs your queries on the remote site, another runs on the server which holds your linked server.
August 1, 2007 at 9:34 am
August 1, 2007 at 10:08 am
Maybe Loner means she uses OPENROWSET?
Greg
Greg
August 1, 2007 at 8:06 pm
Yes, thanks Greg, it is OPENROWSET. My former DBA refused to use linked server because of security reason. One time my co-worker asked me how to query a different database so I told him to use OPENQUERY.
Now I mixed up in this thread. In my current company, they use linked server in almost every procedure. When the table has 6 millions rows, it takes forever to run. So I suggested to use OPENROWSET to retrieve the necessary data from the table in the database at once and put it in a temp table. Then I used temp table to join to the query. the query runs faster than joining a linked server database table to the query.
August 1, 2007 at 8:52 pm
If you copied the data through a linked server to a temp table like you did with OPENROWSET, the speed would be the same.
The problem with OPENROWSET is that the UserID and Password must be hardcoded... that put's in in clear text to anyone who can read the proc. If the security is correct on that proc, that doesn't pose a big problem... what does pose a big problem is if you change the password on the target server for that user (according to PCI requirements, should occur every 3 months or less)... once that happens, you have to go and change all those passwords in code every where you used it. Good luck with that
--Jeff Moden
Change is inevitable... Change for the better is not.
August 2, 2007 at 9:57 am
We used window authentication, so there is no need to put user id and password in the procedure.
August 2, 2007 at 5:15 pm
Doh! My bad... made an assumption Thanks for the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply