David Blomstrom <[EMAIL PROTECTED]> wrote on 02/24/2005 04:10:17
PM:
> Oops, I guess I added wrong.
>
> Nevertheless, unrestricted linking to database tables
> with no keys would increase loading time, right? Is
> there some way to gauge the effect, other than
> tweaking all my scripts and tables and checking the
> load time again?
>
> Thanks.
>
> --- Jay Blanchard
> <[EMAIL PROTECTED]> wrote:
>
> > [snip]
> > Total Size: 133537 bytes
> >
> > HTML: 26538
> > Images: 69020
> > Javascript: 12863
> > CSS: 25116
> > Multimedia: 0
> > Other: 0
> > [/snip]
> >
> > It's all right there and has nothing to do with your
> > database.
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:
> >
Inasmuch as slow query performance will result in slow data retrieval, bad
queries and poor database design can slow down the production of
data-driven web pages. The total time it takes to "see" a requested web
page depends on several factors:
A) The time it takes to request the page from the server
B) The time it takes for the server to validate the user and process the
request
C) The time it takes for the server to produce the requested page
D) The time it takes to move the requested page from the server to the
user
E) The time it takes for the user's browser to render the requested page.
A) you cannot control.
B) is determined by the resources available to your web server. Generally
this takes less than a millisecond but depending on how much preprocessing
is required could take longer (like CGI strings)
C) is what you affect most with your application and database design.
Building complex forms and lots of slow data transfers could make this
step take several seconds or more. Check your queries for efficiency. Do
not ask for the same data more than once, if you don't need to. Avoid most
WYSIWYG web page builders as their code is usually not as efficient as
hand-written.
D) is related to 2 factors: how much data is being sent to the user (which
you may or may not be able to control) and how fast is the user's
connection. If you have gobs and gobs of information (like huge pictures
or long lists) then the amount of information the user has requested is
large and it will take a while to get there. The faster the connection,
the less time it takes to transfer the same quantity of data.
E) Believe it or not, you can have an effect on this. Poorly designed HTML
can sometimes take quite a while to render even on very fast equipment.
The stats you were given tell you how much information a user needs to
render a page of your site. 25K of just formatting information sounds like
overkill (your CSS content) as you are only formatting 26K of HTML. Try to
simplify your presentation so that you can reduce the size of your CSS
file(s).
To answer your question: No, doing lots of queries on web pages does not
slow them down unless you have written slow queries. Sure there is some
overhead (usually on the order of sub-seconds) for each query (query
request+server processing+data returned+data formatting) but if you have
well-tuned queries, it shouldn't hurt you too much.
I have one page that has to render nearly 1MB of data on a single page. It
takes less than a second to get the info from the database but several
seconds to format it and send it down the wire to the user. In this case
there is no tweaking I can do to the database to get at the data any
faster so I am working on faster formatting and trying to simplify the
final output so that it takes less time to head down the wire (smaller
packet) and render in front of the user(less work for the browser = faster
presentation).
Benchmarking any application's performance requires you to measure, tweak,
repeat. Sometimes the tweak is a major change but you always keep the end
goal in mind, the user's impression. If it seems fast because you can
render your information on-the-fly, your users will think it's a fast
site. If you leave the user hanging for several seconds while waiting for
their screen to change, you end up giving the impression that you have a
slow site. Why do you think so many programs have a "splash screen" when
they start up? It distracts the user with graphics and text so that they
don't count the rest of the ticks until the program finishes setting
itself up.
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine