× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Sun, Mar 28, 2021 at 7:03 AM Patrik Schindler <poc@xxxxxxxxxx> wrote:

Problem solved. Thanks a lot for great your help and valuable input!

Wrong! I used the wrong test string. It should have been

SELECT ucword FROM ucwrdlstpf WHERE ucword LIKE '______C_U%'

And indeed, with that and the per-char indexes, a full-table scan happens.

SQL optimizers have never struck me as very clever. They do
straightforward, obvious things, and do them very well, sometimes
freakishly well. But they are not ingenious at all. Not even a little
bit. (Maybe these days there are cutting-edge,
machine-learning-powered query engines that are changing this?)

In principle, if you have an index on the 7th position, you should be
able to quickly find all the rows with 'C' in that position. Surely
that would eliminate the need for scanning the whole table. You can
easily write a simple RPG program to do it, given such an index,
right?

So a mix of single-char wildcards and constants could, in theory, be
sped up significantly by those substring indexes. If the query engine
isn't clever enough to figure that out on its own, perhaps there is a
way to rewrite your query to make it clearer. Or maybe there isn't, I
don't know. (I have often written queries that *I* think should be
extremely obvious to the query engine how to make use of indexes, but
it stubbornly refuses to use them.)

Variable-length wildcards are another matter. They are inherently harder.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.