homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

How to make a SPEEDY database

10+ Year Member

Msg#: 52 posted 4:55 pm on Sep 23, 2005 (gmt 0)

I've recently put together a new site using PHP and MySQL.

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.




WebmasterWorld Senior Member topr8 us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 52 posted 5:23 pm on Sep 23, 2005 (gmt 0)

first off are you sure it is the database that is slowing you down?

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!


10+ Year Member

Msg#: 52 posted 7:03 pm on Sep 23, 2005 (gmt 0)

or there could be something horribly wrong with your PHP code in general. Happened to me once,darn loops :)


WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month

Msg#: 52 posted 6:54 pm on Sep 24, 2005 (gmt 0)

1: How often does the data in the database change?

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.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved