Sujet : Re: The joy of FORTRAN
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : alt.folklore.computers comp.os.linux.miscDate : 27. Feb 2025, 22:39:25
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vpqm2d$39d65$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
User-Agent : Pan/0.162 (Pokrosvk)
On Thu, 27 Feb 2025 12:04:15 +0000, The Natural Philosopher wrote:
Ummmmmm ... SQL from *anything* isn't especially "pleasant' 🙂
It is if you restrict yourself to just a few library bits that work
[well]
I think the most complex query I’ve done is a 7-way table join.
I found out early that MySQL was really really good at very simple
queries but was abominably slow at processing complex ones and it was
better to not try and write the One True SQL statement, but several
simple ones and to manipulate the data in C afterwards.
Quite the opposite. One of my jobs is to maintain and continue development
of a system written in PHP for a client by some previous developer who
only knew ... PHP. One of the reports it generates is a list of hours
worked over a range of dates. The original code did a separate query for
each date in the range. So the longer the interval, the slower it went.
(E.g. a query covering 6 months could get pretty painful.) I replaced that
code with a single query over the entire date range, where my code looped
over the result records and grouped them accordingly for output.
Result: much faster results -- even a query covering 6 months would appear
in just a few seconds.
Moral: the more information you give the query optimizer, the more
efficiently you will get results.