Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible for SELECT to be faster?
Message
De
26/10/1998 09:38:28
 
 
À
26/10/1998 09:30:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00150454
Message ID:
00150460
Vues:
19
>Hello,
>
>I am using Visual FoxPro 6.0. I am making a search-form. On that search form there are a couple of textboxes, a search-button and a grid. If I fill in the textboxes and press the search-button a SELECT-command is being executed and the result of the search will be showed in the grid. This is all working fine, but there is only one problem. The problem is that it is taking to long to show the results.
>
>The SELECT-command is using a couple of tables at the same time. The main table, 23000 records, has some fields with only numbers in them. Those numbers are also stored in sub-tables along with the descriptions of the numbers. Those descriptions has to be showed in the grid. The problem is that it is taking to long to show the results. Is there something I am doing wrong? Or is there a faster way to show the results. The SELECT-command I am using is located at the end of this message. Thank you in advance for your time.
>
>SELECT Bedrijf.DossierNr, ;
> UPPER(Bedrijf.BedrNaam), ;
> UPPER(Straat.Om), ;
> ALLTRIM(Bedrijf.Nummer), ;
> StatBedr.Om_NL, ;
> VestType.Om_NL ;
>FROM Bedrijf, ;
> Straat, ;
> StatBedr, ;
> VestType ;
>WHERE Bedrijf.Straat = Straat.Straat ;
> AND Bedrijf.StatBedr = StatBedr.StatBedr ;
> AND Bedrijf.VestType = VestType.VestType ;
> AND &mSeekDosNr ;
> AND &mSeekBedrNm ;
> AND &mSeekHandNm ;
> AND (&mSeekBranch1 ;
> OR &mSeekBranch2 ;
> OR &mSeekBranch3 ;
> OR &mSeekBranch4 ;
> OR &mSeekBranch5) ;
> AND &mSeekStraat ;
> AND &mSeekStatus ;
> AND &mSeekDatIns1 ;
> AND &mSeekDatIns2 ;
>ORDER BY 2 ;
>INTO CURSOR Result

Firstly, using UPPER,ALLTRIM you slow down the query. Secondly, you have too many filter conditions. Basically, you should build common &cWherestring and it will include all AND/ORs only in case when all serach textboxes will be filled. Surely, you should provide Rushmore optimization having TAG for each join/filter expression, or at least for the most commnoly-used ones. Also, it's helpful to have tag on DELETED(),at least in master table. The last straw, which might be tried after all other options, is to move joints from SELECT to Grid.Column.Controlsources
Edward Pikman
Independent Consultant
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform