Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: open
My site load times are horrible and thus leads me to ask what determines database speed?
1. The number of connections to the database? For instance I have some portal pages that have 5 recordsets on a single page.
2. Type of query? (i.e. simple vs. complex)
3. The size of the database (mine is VERY small at this point and that is why I am troubled) Also I am the ONLY users accessing the info as well.
i test this by writing the time to a variable, looping through 100s of queries/connections in the code then getting another time variable,
subtract the two times to see how long the queries took?
if you find it is still the db server that is the slow point, then optimising your queries can be very important (do a search on this - the way complex queries are written can make a very big difference)
with mysql i open then close it as quick as possible but i have very fast pages on shared host environments that are making 6 db connections, so i don't think that in itself is a problem
[side note - with sqlServer i just open one connection and reuse it on the page as often as i need then close it at the end of the page]
... of course the db server could just be overloaded with other people using it if you are sharing it, even if your own queries are honed to perfection!
2: Could the index page with the data be published as a static page periodically rather than having each user load it fresh every time they hit the site?
The first question is a very important one, especially if your site is going to be a busy one. The second is a potential solution.
It sounds like the SQL query is doing a big query across all tables at the same time rather than a set of simple, and fast, queries.
If you could post the SQL, this could be established.