July 3, 2014 at 10:56 am
Long story short - our company's primary operational database is poorly designed and has been poorly maintained in the past. We can't rely on the suppliers to improve things for our purposes so we're looking into developing a database containing objects that would act on the former database (e.g. cleanup procedures, additional data storage and reporting functions).
Would anyone know what the extent of performance costs is of using procedures, functions or views from one database on data from another if both databases are on the same server? Are there any reasons why this might be a horrible idea in general? I want to avoid creating objects in the existing database as it's already cluttered with hundreds of tables and thousands of SPs...
July 3, 2014 at 11:58 am
on the same server, i believe it's no problem; every query eventually gets resolved to all objects to thee part naming conventions...database.schema.object;
I have a system I babysit that we recently migrated to use Synonyms for the three part objects, to make it easier to build development vs QA vs production instances.
you can look at the execution plans of those kinds of multi database operations, there's nothing different than when all the objects are in the same database.
Lowell
July 4, 2014 at 2:24 am
Excellent, that's just what I wanted to hear!
July 4, 2014 at 6:10 pm
I absolutely agree with Lowell but let me give you another hint that will save much in the area of agony in the future....
Don't use anything more than the 2 part naming convention in any of your code. Use only the 2 part naming convention. If a table is in a different database, then create a synonym that's naming using 2 part naming to point to the object in the other database.
Why? First, it hurts nothing for performance. Second, it makes programming easier. Third, you won't have to change any of your code if you decide to move a table to different database or even rename the whole database. Instead you only need to change the synonym(s).
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply