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

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

new
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Full Schedule
g
g ASP Site

BellaOnline's ASP Editor

g

Coding for Fast Database Connections


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
Add Coding+for+Fast+Database+Connections to Twitter Add Coding+for+Fast+Database+Connections to Facebook Add Coding+for+Fast+Database+Connections to MySpace Add Coding+for+Fast+Database+Connections to Del.icio.us Digg Coding+for+Fast+Database+Connections Add Coding+for+Fast+Database+Connections to Yahoo My Web Add Coding+for+Fast+Database+Connections to Google Bookmarks Add Coding+for+Fast+Database+Connections to Stumbleupon Add Coding+for+Fast+Database+Connections to Reddit




RSS | Related Articles | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


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


Content copyright © 2014 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 Lisa Shea for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


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


BellaOnline Editor