logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
Spirituality
Home Improvement
Vegetarian
NASCAR
Southcentral USA


dailyclick
All times in EST

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

Coding for Fast Database Connections
Guest Author - Lisa Shea

If you're a database developer, one of your most important tasks is to write your code properly, so pages load as quickly as possible. If your pages load slowly, your visitors are likely to go elsewhere!

Remember that every separate SQL statement you issue requires data to go back and forth to the database. Sometimes those handshakes and open/closing of connection can take longer than the actual database query! Look closely at all SQL statements you have on a given page. Try to combine them into as few queries as possible.

Next, run an 'explain' on each query to determine how the database will execute it. Make sure you tweak your indices and keys until the query runs as efficiently as possible. You want to avoid table scans - try to do your "where" clause to use indexed fields as much as possible. If you do a "where site_id = 1 and cat_id = 2", make sure you have an index set up on both site_id and cat_id.

When you do issue a SQL statement, use it as quickly as you can and then close it up. Don't leave it open while you do other things. Grab the values you need, stick them into variables, and then close up the statement.

Finally, be sure to set all connections back to nothing when you're done with them.

The more efficient your code is, the more quickly the page will get to the end user - and the happier your visitors will be!

Coding for Fast Page Viewing

This site needs an editor - click to learn more!

RSS | Related Articles | Previous Features | Site Map


Content copyright © 2008 by Lisa Shea. All rights reserved.
This content was written by Lisa Shea. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

Digg! g delicious Save to Del.icio.us

g


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Driving Amount
Much more
Slightly more
Slightly less
Much less

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2008 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor