Select Categories Below
Advertisement
Start Your Own Q&A Site
Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.
Status: Open Points: 250 Time: 01:22 - Apr 11, 2008
sukeshjph
Derived tables in sql server 2005 can be used for joins which treats a subquery as a tabke..can i know some more about this and its drawbacks ...where to use it and where not to.
Categories:
Add Categories
When adding more than one category, separate them with commas.
Suleman
Date:: Jul 16, 2010
Time:: 10:19
Hi Sukeshiph, A derived table is a virtual table that's created and populated on the fly from a select statement. In concept this is similar to creating a temporary table and then using the temporary table in your query, but the approach is much simpler, coz it can be done in one step. This can be tremendously useful in certain situations. Some times derived tables can be most useful, for instance you need to create a view for a single query and then you want to use it within another query and after that the view should be dropped because nothing else uses this view, in this context derived tables suit you best and benefits you by saving to create you a catalog entry in the form of view in the server. For repeated queries, a SQL derived table used multiple times performs well with cached definition. It will not degrade your performance. A SQL derived table differs from a temporary table in that a SQL derived table exists only for the duration of the query, while a temporary table exists until the SQL Server are recycled or the temporary table is dropped manually and also it uses lots of disk space than a derived table in the temdb database. So it's better to make use of Derived tables wherever possible by eliminating the rearely used or one time only views and by eliminating the temporary tables. You would gain a lot of performance gain using a derived table when compared to using a temparory table as illustrated below: Steps needed to read from a temporary table: 1. Lock tempdb database 2. CREATE the temporary table (write activity) 3. SELECT data & INSERT data (read & write activity) 4. SELECT data from temporary table and permanent table(s) (read activity) 5. DROP TABLE (write activity) 6. Release the locks Compare this with the number of steps required for a derived table: 1. CREATE locks, unless "read uncommitted" isolation level is specified. 2. SELECT data (read activity) 3. Release the locks Thus derived tables require less I/O and less disk space. Hope this was helpful.
admin
Date:: Mar 31, 2012
Time:: 13:57
The question looks to be abandoned by the user who asked it. If no action is taken within 2 days, a Quomon Moderator will consider closing the question and distributing the points. The Quomon Team
Answer this Question
New User
Email:
Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address
Registered User
Username:
Password:
Forgot Your Password?
Enter your email address below and we will resend your login information to you.
Login Information Sent
Questions
I lost sql server password, how i can reset sql sa password?
You have 100 characters to use
Rank
Expert
Points
1.
10354
2.
6493
3.
5596
4.
4848
5.
3487
6.
2840
7.
2770
8.
2303
9.
1820
10.
917
Register today to share your knowledge with the community and be recognized and rewarded for your contributions.
Register Here
"Psst, Quomon is a great site. Pass it on." Tell a Friend | Link To Us | Save to Delicious | Digg it
Language Options
English:
Español:
Sponsors
Questions and Answers Software