Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro Newsgroups: alt.folklore.computers,comp.os.linux.misc Subject: Re: The joy of FORTRAN Date: Thu, 27 Feb 2025 21:39:25 -0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <5mqdnZuGq4lgwm_7nZ2dnZfqnPSdnZ2d@earthlink.com> <59CJO.19674$MoU3.15170@fx36.iad> <3hOdnWpQ649QMGr7nZ2dnZfqnPidnZ2d@earthlink.com> <1smdnSjX3YoxgWf7nZ2dnZfqn_idnZ2d@earthlink.com> <1396870532.749421730.052473.peter_flass-yahoo.com@news.eternal-september.org> <1214951717.762291306.657281.peter_flass-yahoo.com@news.eternal-september.org> <5DWdnXyIYo7er136nZ2dnZfqnPednZ2d@giganews.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 27 Feb 2025 22:39:26 +0100 (CET) Injection-Info: dont-email.me; posting-host="5663112188f1f002c68c712720ef74d4"; logging-data="3454149"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1++tj0+btjbDFn9LNBMwBMu" User-Agent: Pan/0.162 (Pokrosvk) Cancel-Lock: sha1:w2jg3xaVLxhYSRtW7X1L1VNprjg= Bytes: 3313 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.