Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Search
Message
From
10/07/2008 06:29:50
 
 
To
10/07/2008 06:04:35
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Re: Search
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01330151
Message ID:
01330155
Views:
21
Mohammad,

please read this, I have written it a zillion times: You must NEVER, NEVER, NEVER us ANY reference to ANY object within a select statement!!!!!!!!!!!!!!!!!!!! The reason is that if you do, the search engine must evalute this expression FOR EVERY RECORD in your table, in this case 6000000 tiems. This is the primary reason why this is sloooooooowwwww!

An index tag on name1+name2+name3+nam4 normally have NO VALUE whatsoever. Instead you use four tags, one for name1, one for name2, one for name3 and one for name4.
at thisform.text3.value..event ineractivechange
if LEN(ALLTRIM(thisform.text3.value)) >= 3
        * set step on
For x=1 to getwordcound(thisform.text3.value)
  lcName = getwordnum(thisform.text3.value,m.x)
  if m.x=1
    SELECT name1,name2,name3,name4 from med;  
       where  name1=lcName or name2=lcName or name3=lcName or name4=lcName;
       ORDER by name1; 
       into cursor crsMyCursor readwrite
  else
    SELECT name1,name2,name3,name4 from crsMyCursor;  
       where  name1=lcName or name2=lcName or name3=lcName or name4=lcName;
       ORDER by name1; 
       into cursor crsMyCursor readwrite
  endif
endfor 

          thisform.Grid1.RecordSource="crsMyCursor"
          thisform.grid1.Visible=.t.
<pre>
**event ineractivechange
** Use the same approach here!!!!
>hi all,
>
>i need to quick search via name at my table(more than 6 milion records)
>
>i have fields name1,name2,name3,nam4,
>
>i need to search name1
> or name1 + nam2
> or name1 + name2+name3
> or name1 +name2 +name3 +name4
>
>or name2
> name2+name3
> or name2+name3+name4
>
>
>or name3
> or......etc
>
>
>i try it as
>1. i made index as index on name1+name2+name3+nam4 tag any name????
>
>2.
>
>at thisform.text3.value..event ineractivechange
>if LEN(ALLTRIM(thisform.text3.value)) >= 3
>        * set step on
>
> SELECT name1,name2,name3,name4 from med;
>        where  atc(trim(thisform.text3.value) ,name1)>0 ;
>         ORDER by name1;
>          into cursor crsMyCursor
>
>          thisform.Grid1.RecordSource="crsMyCursor"
>          thisform.grid1.Visible=.t.
><pre>
>**event ineractivechange
> if LEN(ALLTRIM(thisform.text3.value)) >= 3 AND LEN(ALLTRIM(thisform.text19.value)) >= 3
>
> SELECT name1,name2,name3,name4 from med;
>        where  atc(trim(thisform.text3.value) ,name1)>0 or atc(trim(thisform.text19.value) ,name2)>0;
>         ORDER by name1;
>          into cursor crsMyCursor
>
>          thisform.Grid1.RecordSource="crsMyCursor"
>          thisform.grid1.Visible=.t.
>
>
>.
>.
>.
>.
>
>thank
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform