Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL-VIEW syntax - how to speed requery()
Message
From
04/11/2003 05:22:26
 
 
To
03/11/2003 14:26:11
Todd Cottengim
Alpine Land Information Services
Redding, California, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00845746
Message ID:
00845934
Views:
14
Hi Todd,

try this
CREATE SQL VIEW (lcView) AS ;
  SELECT ;
    pri.plot_id, pri.meridian, pri.section, pri.strip, pri.plot_num, ;
    ;
    pri.plottype_id, pt.name as pt_name, ;
    ;
    pri.ws_id, wss.name as ws_name, ;
    ;
    pri.dist_id, dst.name as dist_name, ;
    ;
    pri.latitude, pri.longitude, pri.travel, pri.cruisers, pri.date, ;
    pri.elevation, pri.slope, pri.baf, pri.calc_site, pri.mgmt_site, ;
    ;
    pri.ldeleted ;
  FROM FORCE PlotFilter flt ;
  JOIN crzplots pri ON pri.plot_id = flt.linkfield ;
  JOIN watersheds wss ON wss.ws_id  = pri.ws_id ;
  JOIN districts dst ON dst.dist_id = pri.dist_id ;
  JOIN plot_type pt ON pt.plottype_id = pri.plottype_id ;
  ORDER BY meridian, section, strip, plot_num
Before, try the view without the ORDER BY and see the time.

For me VFP cannot optimize the ORDER BY;
if ORDER BY is the the bottle neck,
you can optimize this manually with low level table functions ( SCAN INSERT INDEXSEEK ... )
SELECT ... FROM crzplots pri where .F. INTO CURSOR myView READWRITE
SELECT crzplots
SET ORDER TO meridian_section_strip_plot_num
SCAN FOR InsertThisCondition
  INSERT INTO myView ....
ENDSCAN
Fabio
Previous
Reply
Map
View

Click here to load this message in the networking platform