Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Multiple join conditions on indexed fields VERY slow...
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00901362
Message ID:
00901396
Views:
22
Darren,

I've run into similar issues before.

What worked for me was that I broke my SQL statement into a few of them. This way each index used for optimization.

Using your statement:
select b.* from detail d join barcodes b on d.po_num = b.po_num and d.style = b.style where d.wo_num = 123456 into cursor csrBcodes

*Break this into :

select d.po_num as po_num_d,d.style as style_d from detail d where d.wo_num = 123456 order by 1 into cursor csrBcodes nofilter 

select csrBcodes.style_d,b.* from csrBcodes join barcodes b on csrBcodes.po_num_d = b.po_num order by 1 into cursor csrBcodes nofiler 

select csrBcodes.* from csrBcodes where style_d = style into cursor csrBcodes nofiler 
Hope this helps

Dawa

>hi,
>
>i'm attempting to join 2 fairly large tables (200,000 recs each) on multiple fields via:
>
>select b.* from detail d join barcodes b on d.po_num = b.po_num and d.style = b.style where d.wo_num = 123456 into cursor csrBcodes
>
>d.wo_num, d.po_num, d.style, b.po_num & b.style are all indexed, yet this query takes more than 30 secs. if i limit the join condition to a single field - either po_num OR style - the query runs in less than a second??!
>
>any thoughts? are multiple condition joins just slow??
>
>thanks in advance.
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Previous
Reply
Map
View

Click here to load this message in the networking platform