Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Optimization
Message
 
To
09/11/2005 17:15:14
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01066940
Message ID:
01066985
Views:
18
This message has been marked as the solution to the initial question of the thread.
Renauld,
Here full optimization:
CREATE CURSOR Mytable (DocId I, CAddress C(50), cStatus C(3), DDate T)
INSERT INTO MyTable VALUES (1,'asdasdasd','AAA',DATETIME())
INSERT INTO MyTable VALUES (1,'asdasdasd','XXX',DATETIME())
INDEX ON DocId TAG DocId
INDEX ON CStatus TAG CStatus
INDEX ON TTOD(DDate)TAG DDAte
tDateFrom = DATETIME()-10000
tDateTo   = DATETIME()+3600
SYS(3054,12,"sss")
   SELECT count(*);
          FROM MYTABLE;
          WHERE MYTABLE.docid = 1 AND;
                MYTABLE.cstatus <>  "XXX"    AND;
                BETWEEN(TTOD(MYTABLE.ddate), tDateFrom, tDateTo);
   GROUP BY MYTABLE.caddress;
   INTO ARRAY laCount
MessageBox(sss)
>Thanks for the immediate reply. Here is the results...
>
>Using this code:
>SYS(3054,12,"sqlTest")
> SELECT count(*);
> FROM MYTABLE;
> WHERE MYTABLE.docid = doctor.docid AND;
> MYTABLE.cstatus <> "XXX" AND;
> BETWEEN(TTOD(MYTABLE.ddate), tDateFrom, tDateTo)
> GROUP BY MYTABLE.caddress;
> INTO ARRAY laCount
>MessageBox(sqlTest)
>
>*------------------------------------------------------
>This is the result when I run the expression that you wrote.
>
>Using index tag xdocid to rushmore optimize table dispatch
>Rushmore optimization level for table MYTABLE: partial
>*------------------------------------------------------
>Now if i put 2 index for CStatus and TTOD(DDate) will this make a difference? What is the quickest way to time this?
>
>For my date field (MYTABLE.DDate), this is a DATETIME type but my low/high value are DATE type so i have to convert my MYTABLE.DDate with TTOD function.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform