Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This is a surprise
Message
De
28/02/2000 01:11:41
 
 
À
28/02/2000 01:08:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00338270
Message ID:
00338294
Vues:
18
I'm confused. Maybe I haven't drank enough tonight :-D

>Now with SET OPTIM OFF the single query slows down remarkably but the UNION is still blazingly fast!
>Gets better doesn't it :-)
>
>
>>I see. Hmmm.....that is strange. Try running with OPTIMIZE set OFF and see what happens.
>>
>>>No, the UNION is much much faster! That's what I'm surprised at.
>>>
>>>>I don't think UNIONS are fully optimizable, Dave. That might explain it. Try both SQLs with SET OPTIMIZE OFF and see what the differences are.
>>>>
>>>>
>>>>>Address is a table with 400,000 records indexed on Addrnum
>>>>>Cons is a table of 120,000 contacts indexed on CCust
>>>>>Both have tags on DELETED()
>>>>>
>>>>>The query...
>>>>>
SELECT A.* FROM Address A, Cons C ;
>>>>>  WHERE C.CCust = "GREATLA2" ;
>>>>>  AND C.PAddrnum = A.Addrnum ;
>>>>>UNION SELECT A.* FROM Address A, Cons C ;
>>>>>  WHERE C.CCust = "GREATLA2" ;
>>>>>  AND C.Addrnum = A.Addrnum
>>>>>
>>>>>runs about 50 times faster than...
>>>>>
SELECT A.* FROM Address A, Cons C ;
>>>>>   WHERE C.CCust = "GREATLA2" ;
>>>>>   AND (C.Addrnum = A.Addrnum OR C.PAddrnum = A.Addrnum)
>>>>>
>>>>>Both queries show as fully optimized with SYS(3054,1), both return the same result set.
>>>>>Strange uh!
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform