Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HowTo: Release a Table variable
Message
De
12/01/2005 15:03:11
 
 
À
12/01/2005 12:02:22
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00976391
Message ID:
00976513
Vues:
15
>Absolutely not.
>A stored procedures can be much complex and the created temporary tables can be many,
>and the duration can be much long (also 1 hour);
>if all this comes projected with the access of 1000 or more customers,
>the memory allocation becomes much inefficient one.
>
>Too much difficult to make a RELEASE @Table?
>
>Another mystery ?
>
No, not really. I don't believe table variables were meant to be used in such a way. And, IMHO there are no good reasons for a query that complex. If more than a handful of users run it, the server performance will go to zero.

There are many ways around using table variables. You may be able to eliminate some with correlated subqueries, derived tables, or other different SQL statements. Try breaking the stored proc down into smaller pieces; user-defined functions are good for this. Does the information the SP is going to return need to be real-time? If not, you may want to load the data in to permanent, more denormalized tables on a nightly basis.

Give a great deal of thought as to why you need to write something that complex. There may be many better ways to do it.
Dan LeClair
www.cyberwombat.com
SET RANT ON - The Wombat Blog

Life isn’t a morality contest and purity makes a poor shield. - J. Peter Mulhern
Disclaimer: The comments made here are only my OPINIONS on various aspects of VFP, SQL Server, VS.NET, systems development, or life in general, and my OPINIONS should not be construed to be the authoritative word on any subject. No warranties or degrees of veracity are expressed or implied. Void where prohibited. Side effects may included dizziness, spontaneous combustion, or unexplainable cravings for dark beer. Wash with like colors only, serve immediately for best flavor.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform