Re: Force index usage
Posted in 1997
rferdy@kuwait.net (Rudy Fernandes) wrotg: >...[snipped]... >Our solution, probably of academic interest only now, went something >like this. > >Background: A Reporting 4GL could be used for multiple purposes. The >selection criteria, therefore, allowed constraints on many columns >of the table(s). >Depending on what the user wanted from the database, s/he would >constrain specific columns and leave the others 'open'. > >Solution : Our 4gl program would examine the constraints entered by >the user on the screen, and using some very basic rules, conclude >which of the competing indexes was the best. The Select stmt used >to retrieve information would then be constructed without WHERE >clauses on columns whose indexes we did not want to use. > >We would PREPARE the select char variable, DECLARE the cursor and >then OPEN it using only the required user-entered constraints. > >Within the FOREACH loop, we would discard unwanted rows. > >Its surprisingly simple syntax once you get the hang of it and we >used it quite effectively in quite a few reporting 4gls where the >user requirements and index choices were very clear. > >We have not rewritten these programs to leave the thinking to the >OL7 optimizer, but new 4gls we write do not bother with this sort >of stuff anymore. > >BTW, 'force index' is NOT on my wish list (Please, no salvos) Hi--- I'm still in the 4GL 4.1, OnLine 4.0 world. Is a suitable example that you can give me for what you speak of? --- dave koehler Anti-spam address!!! Change the "fantasia.com" to "ameritech.net".