Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speed query with rushmore index
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 5
Miscellaneous
Thread ID:
01202405
Message ID:
01202856
Views:
15
>>>>You have to try it out, it's never possible to calculate how fast a query will run. However, with the right indexes, your query should be almost instant.
>>>
>>>After all, I just needed an inner join which runs very fast without the indexes. But I tried your suggestion on another query w/o succes, somehow I can't seem this to work. It's a very simple query with the right indexes in the right place:
>>>
>>>
>>>
>>>Select mutbdrg.*;
>>>from mutbdrg;
>>>inner join mutaties;
>>>on mutaties.mijbrpls = mutbdrg.mijbrpls and mutaties.vlgnr_mut = mutbdrg.vlgnr_mut;
>>>where year(mutaties.verw_mut) = 2007;
>>>into cursor curMutaties
>>>
>>>
>>>
>>>I opened the database and set an index on mijbrpls, vlgnr_mut for both mutaties en mutbdrg. Furthermore an index on verw_mut for mutaties. But the query is very slow.... I have to say the tables are big: Mutaties(5 million),mutbdrg(8 million)
>>>
>>>Am I doing something wrong?
>>>
>>
>>Change your where clause to match your index, e.g.
>>
>>where mutaties.verw_mut between date(2007,1,1) and date(2007,12,31)
>>
>I'm sorry I made a mistake in my message, I indexed on year(verw_mut).
>
>>Also are you sure you need two fields to join your tables? Usually you have one PK/FK combination.
>Well, what I have is the following:
>
>Mutbdrg
>mijbrpls vlgnr_mut bdr_srt bdr_mut
>1 10 "ESTKST" 10
>1 10 "VSCPM" 10
>1 11 "KLM" 20
>..
>Mutaties
>mijbrpls vlgnr_mut verw_mut
>1 10 01/01/2007
>1 10 03/01/2007
>1 11 01/01/2006
>
>I want to get:
>mijbrpls vlgnr_mut bdr_srt bdr_mut
>1 10 "ESTKST" 10
>1 10 "VSCPM" 10
>
>In fact I also tried
>
>Select mutbdrg.*;
>from mutbdrg;
>inner join mutaties;
>on mutaties.mijbrpls = mutbdrg.mijbrpls;
>where year(mutaties.verw_mut) = 2007;
>into cursor curMutaties
>
>
>But this also takes very long, so long that I can't wait for the result and have to interrupt it. So I think I don't need two fields, but this doesn't seem to work either.

Looks like you DO need both fields in your join condition. You also have to make sure that your WHERE condition matches EXACTLY the index expression. So, it either should be index on YEAR(verw_mut) tag YEAR_DATE or simple index on date, but then you should use date range instead of years.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform