Various folks responded to my question:
> [EMAIL PROTECTED] wrote:
>
> > I've noticed that when developing queries involving complex joins on
> > tables I sometimes seem to get appallingly long times the first time I run
> > a query, but the second and subsequent time I run it - even substituting
> > a different value for a field value I'm matching on - the query runs
> > quickly.
> >
> > Does mySQL do some behind-the-scenes reindexing the first time,
> > resulting in the speed differences I see? If so is there some way I can
> > force it to re-build indices periodically so I can ensure that queries are
> > generally fast? Is this the point I should be going out and buying a book
> > about mySQL? ;-)
Along the lines of:
> I think its because the Operating System is caching the data the query are run on
What I didn't emphasise in my original email was that the
differences I was getting were of the order of SEVERAL MINUTES first time
and a few seconds for subsequent queries! I think this has got to be too
much to be explained by disk caching (feasible if the system had data
stored on tape maybe ... ;-)
I can't readily reproduce the first-time big difference scenario.
I've seen it 2 or 3 times, developing quite different queries. I seem to
get queries speeding up slightly in a way which fits with the improvement
I'd expect from disk caching when doing sort of variations on a basic
query (e.g. joining in on another table). I just wondered if mySQL was
doing some cunning optimisation after the first big hit.
regards,
--
John Stumbles [EMAIL PROTECTED]
I.T. Services Centre, University of Reading http://www.rdg.ac.uk/~visstmbl
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
never generalise
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php