Subject | sql query vs view vs stored proc. performance question |
---|---|
Author | nagypapi |
Post date | 2008-07-18T18:33:43Z |
We are frequently executing sql queries (every 10-20 seconds) that
involve joins with 4-5 tables with 10 000 - 50 000 rows each. And we
are also ordering the result with order by clause.
We indexed all relevant columns.
I was wondering about the best solution speed-wise (memory we have
enough):
1. executing sql queries every time
vs
2. Creating a view (can a view have a nested, joined, etc statement?)
vs
3. Using a stored procedure to execute the query
vs
4. Any other solution
Before I start testing, I would like to ask the experienced, or
experts who know how the engine works: which solution should yield the
best speed?
Thanks!
John
involve joins with 4-5 tables with 10 000 - 50 000 rows each. And we
are also ordering the result with order by clause.
We indexed all relevant columns.
I was wondering about the best solution speed-wise (memory we have
enough):
1. executing sql queries every time
vs
2. Creating a view (can a view have a nested, joined, etc statement?)
vs
3. Using a stored procedure to execute the query
vs
4. Any other solution
Before I start testing, I would like to ask the experienced, or
experts who know how the engine works: which solution should yield the
best speed?
Thanks!
John