multiple db connections-your advice needed

J

Joey Martin

On my website, I want to provide 3 pieces of statistics that will
require 3 queries to my SQL database. As much as I'd like these to be
live, they are part of a footer that will load each time for about 10
pages on my site. I am thinking that, although they are simple queries,
it may be just too much.

What do you recommend?
I could open the connection, run the query and then close it, each time.
Would this be a recommend plan?

Or, should I create a daily task that builds a simple text file with
those query results and just pull those in each time the footer is
loaded? This would not be live, but I can deal with it.

What do you all think?
 
T

Tom Kaminski [MVP]

Joey Martin said:
On my website, I want to provide 3 pieces of statistics that will
require 3 queries to my SQL database. As much as I'd like these to be
live, they are part of a footer that will load each time for about 10
pages on my site. I am thinking that, although they are simple queries,
it may be just too much.

What do you recommend?
I could open the connection, run the query and then close it, each time.
Would this be a recommend plan?

Or, should I create a daily task that builds a simple text file with
those query results and just pull those in each time the footer is
loaded? This would not be live, but I can deal with it.

What do you all think?

Why not test option #1, and if it doesn't work, go with #2?

--
Tom Kaminski IIS MVP
http://www.microsoft.com/windowsserver2003/community/centers/iis/
http://mvp.support.microsoft.com/
http://www.iisfaq.com/
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://www.tryiis.com
 
J

Joey Martin

It's not whether it will work or not, because I know it will. But from a
performance/bandwidth perspective, I am curious which is better.
 
T

Tom Kaminski [MVP]

Joey Martin said:
It's not whether it will work or not, because I know it will. But from a
performance/bandwidth perspective, I am curious which is better.

That's what you need to test in your specific environment.
 
P

Patrice

In this particular case :
- if not too costly (no need to cache) you'll have the benefit of live
statistics
- if too costly and cached you can live with it

Now as said Tom, you are the only one that can define if it is actually too
costly or not... Note that if properly wrapped into a "function", the app
itself won't need to know wether or not it is cached and you'll be able to
easily cache or not these data by updating a unique function...

Patrice
 
M

Mark Schupp

How often does the data change?
Is it different for different users?

If it is the same for all users you could keep it in application variables
and do periodic updates.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top