Which is quicker- tables or functions

  • I'm trying to create an Extract from source data that is too complex to be created as a view (also have been instructed not to use views). I have to run many queries to get the data required and insert into the new Extract table.

    What do you think of using a series of inline functions to run the intermediate sql, then using outer joins to put them all together into a table? (as opposed to creating then deleting a lot of tables).

    If this doesn't make sense, let me know 😉

  • Sometimes you'll benefit, sometimes not. Honestly I think you'll have to benchmark to see. I'd say the biggest point is whether you would gain performance by indexing temp tables, something you cant do to a function.

    Im curious, why dont they want you to use a view?

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • The people my colleague and I are working for built a SQL Server reporting database with no DBA experience. When they originally created it, they didn't use views/ temp tables etc. because they didn't know how to use them. Now they have a large database without these features, and are not keen for us to add them, as they will not be able to maintain them after we go back to Australia !!

  • Seems like if they were willing to do functions then views are bit less complicated, sort of. Ah well, what can you do!

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply