Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL LIKE and Rushmore optimization
Message
From
20/01/2006 08:05:44
 
 
To
20/01/2006 07:26:32
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01088808
Message ID:
01088847
Views:
25
Hello,
INDEX ON "1"+UPPER(Description) TAG Test1
though this works, this won't speed up the query since the selectivity of the index is of no value, since every value in this index matches "1". And the rest of the index can't be used cause the second character is "%".

To get good results you'll either need some kind of full-text indexing (with a third party tool) or redesign your data structure.

e.g.

instead of
yourTable (Manufacture C(255), Productgroup C(255), Description C(255), Description2 (255), ...)

somethink like
yourTable (fk_manufacture I, fk_productgroup I, Description C(255), Description 2 C(255), ..)
manufactures (pk_manufacture I, manufacture C(255))
productgroups (pk_productgroup I, group C(255))

manufactures
1 - Hewlett Packard
2 - IBM
3 - Intel
..

productgroups
1 - Printers
2 - Graphiccards
3 - Monitors
4 - Harddisks
...

Then you can write queries like
SELECT FROM yourTable WHERE fk_manufacture = 1 AND fk_productgroup = 1 ..
to get all printers from HP for example.
And this query will scale well beyond table sizes that you probably will ever reach.

Regards
Christian
Previous
Reply
Map
View

Click here to load this message in the networking platform