|Goofy beginners question|
I sat down with a pot of coffee about 22 hours ago and decided it was time to get my head around MySQL. It's working.
I'm going to try to replace some <select> lists with some
queries and screen output and db processing. From what
I've seen so far, which admittedly is not much, it looks
my load time from a table is much faster than loading a
long list in a select statement. Or am I suffering from
a lack of sleep and screen glare?
I'm looking forward to getting back into some database
I can't imagine that adding database calls to your pages has speeded them up... database interaction will normally add significant increases to the page generation time.
Luckily, as the generation time is so fast to begin with, this increase is barely noticeable.
Guessing you mean the difference between SELECTING a lot and SELECTING the bare minimum... if so, you are right - you want to get as small an array as possible with your SELECT statement and then output it.
Most of your overhead comes from connecting to the db the first time... after that queries should be pretty fast.
Hey grandpa, I remember from a previous thread a few months back that your background includes AS/400 experience. Me too. First, is it MySQL you are trying to wrap your head around or is it SQL in general? From the tone of your post, is seems it may be SQL in general so I might assume you never used AS/400 SQL, am I right?
I received a tech email this morning from the Four Hundred Guru which included a nice little article that really covers some of the SQL basics -- and in terminology that you can probably relate to fairly well. Here nor there, give it a once over. If you pick up something new, great, otherwise it will be good reference and reinforcement reading:
Also, as has been stated, the html <select> options are going to be loaded one way or another, dynamically from a database of course adds a bit of overhead. In my own humble opinion, the overhead is minor and the tradeoff is major. Tradeoff being that you can dynamically load your select statement with server-side processing (Perl, PHP, RPG, etc.) as opposed to hard-coding data in an .html document.
That said, MySQL is a very fast database. And here is a little comparison I ran on a test server for you to get a feel for differences in hard-coded <select> lists versus dynamically built <select> lists using PHP and MySQL. The table I built the lists from contains 59 states, including AMERICAN SAMOA, GUAM, etc.:
<select id="State" name="State" size="1">
<option value="WI" selected="selected">WISCONSIN</option>
And, in side-by-side comparison, the:
hard-coded list generated in 0.000164 seconds
dynamic db list generated in 0.003212 seconds
You'll like using SQL. So much so, you may find yourself using it more and more on your 400! Best wishes -- coopster
Mostly I'm just trying to get a grasp on MySQL, and how it
can or cannot benefit the web site I maintain. I did use
use some AS/400 SQL (formerly as a programmer) and we also
brought in a RISC unit... trying to remember what it was..
IBM RS/6000? loaded up with UNIX. The plan was to migrate
away from the 400.. wonder if they got it done? Anyway my
SQL experience is really minimal, and I've never had a
comfort level with SQL.
I'll have a look at the article, thanks.
On my pages I've had up 9 select boxes, each of them with
at least 300 items. Those pages loaded mighty slow. So I
broke them up, but would really like to put all those
options back together again, and this could be the ticket.
I'm in the "early" stage, so things probably can and will
change, but I'm thinking that I can process multiple
selections across what was formerly a variety of lists.
The real design work hasn't even begun, but I was very
happy just to produce a list on a page, with the list
items coming from a query.
|hard-coded list generated in 0.000164 seconds |
dynamic db list generated in 0.003212 seconds
Those numbers don't look so encouraging :-) But I guess it
really comes down to each application. Still, that is an
answer to my question...
So even if SQL is a bit slower, I really think I can
improve the load time for the pages I split apart,
by allowing multiple checkbox selections against a single
I wish! No more 400 for me, I'll be lucky to get upgraded to W2K anytime soon :-)
Thank for all the replies.
I have been playing with PHP for a few months, and recently looked at some scripts using MySQL and I really didn't understand what was going on.
Thanks for the link to the external beginners guide. It clarified a few things that I wasn't sure about, though I need more; lots more.