Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Collate - Index on Deleted() Tag DeletedTag Binary
Message
 
À
26/08/2005 12:41:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01044347
Message ID:
01044379
Vues:
16
Fabio,

Thanks for your attention...

I agree with you (about a binary index does not have collated), but something is wrong with VFP (or with me :-) hehehe)...

So, I created a little program to show what is happen here:
Clear
SYS(3054, 1)
Set Deleted On

Set Collate To "GENERAL"

?
? "I'm using a binary index - Collate: General"
Create Table MyTest (MyId I, Name C (50))
? Cpdbf(), CpCurrent()
Index On Deleted() Tag DeletedTag Binary
Index On MyId Tag MyIdTag
Index On Name Tag NameTag
Insert Into MyTest Values (1,"Joao Bernardo")
Insert Into MyTest Values (2,"João Alberto")
Insert Into MyTest Values (3,"Joao Gustavo")
Select * From MyTest Where Name Like "J%" Order By Name
Close Databases All
Erase MyTest.dbf
Erase MyTest.cdx

?
? "I'm not using a binary index - Collate: General"
Create Table MyTest (MyId I, Name C (50))
? Cpdbf(), CpCurrent()
Index On MyId Tag MyIdTag
Index On Name Tag NameTag
Insert Into MyTest Values (1,"Joao Bernardo")
Insert Into MyTest Values (2,"João Alberto")
Insert Into MyTest Values (3,"Joao Gustavo")
Select * From MyTest Where Name Like "J%" Order By Name
Close Databases All
Erase MyTest.dbf
Erase MyTest.cdx


Set Collate To "MACHINE"

?
? "I'm using a binary index - Collate: Machine"
Create Table MyTest (MyId I, Name C (50))
? Cpdbf(), CpCurrent()
Index On Deleted() Tag DeletedTag Binary
Index On MyId Tag MyIdTag
Index On Name Tag NameTag
Insert Into MyTest Values (1,"Joao Bernardo")
Insert Into MyTest Values (2,"João Alberto")
Insert Into MyTest Values (3,"Joao Gustavo")
Select * From MyTest Where Name Like "J%" Order By Name
Close Databases All
Erase MyTest.dbf
Erase MyTest.cdx

?
? "I'm not using a binary index - Collate: Machine"
Create Table MyTest (MyId I, Name C (50))
? Cpdbf(), CpCurrent()
Index On MyId Tag MyIdTag
Index On Name Tag NameTag
Insert Into MyTest Values (1,"Joao Bernardo")
Insert Into MyTest Values (2,"João Alberto")
Insert Into MyTest Values (3,"Joao Gustavo")
Select * From MyTest Where Name Like "J%" Order By Name
Close Databases All
Erase MyTest.dbf
Erase MyTest.cdx
If you run this code, you will see that just the third Select is FULL optimizated. The others is just PARCIAL.

In my example, I have just 3 records, but in my real application I have a lot of them. And, beliave me, the time of my queries is up to 20 times slower if I add a BINARY index.

Something is wrong... Because BINARY index is just MACHINE, but I need to add some GERERAL indexes in my app. Notice that the first and second results, I have the names ordered correctly (João Alberto, Joao Bernardo and Joao Gustavo), but if I use MACHINE collate (third and fourth selects), I get (Joao Bernardo, Joao Gustavo and João Alberto). In this case (3 records) it is ok, but in a real situation where a lot of users add informations, I need to put it in the right order.

So, I concluded that a BINARY index has a collate too. For my bad luck, it is MACHINE! :-)

Any suggestions?

Thanks again!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform