On Fri, Jul 17, 2015 at 11:32 AM, Ken Dibble <krdib...@stny.rr.com> wrote:
>
> My previous understanding was that if there is a WHERE clause or an ORDER BY
> clause in the query, then VFP always creates the temp file on disk.
>

My belief is very similar to yours, but a little different. If the SQL
engine can give you the result you request by the equivalent of a SET
FILTER on the underlying table OR with a temporary IDX (for the order
clause), it will do this, essentially, taking your:

select * from mytable where somefield = somevalue order by someotherfield

what I imagine that FoxPro does is:

use mytable again in 0 noupdate alias Query
select Query
set fields to <fieldlist> to filter the columns displayed, if you
don't specify "*" in your select statement
set filter on somefield = somevalue
index on someotherfield to mytempidxname

-- gives you exactly the same effect with no need to write records to
disk or copy them to a temp cursor, speeding the result.

Now, in many, many cases, this query result is perfectly acceptable
for what you need it to do. The only issues come up if you ASSuME :)
you can do things with a query result that you shouldn't do..

If you want to be CERTAIN that you are getting a new data file on
disk/in memory disconnected from the original source, you can:

(1) change the structure by adding a field not in the original source,
even a .t. as dummyfield, to the field list.
(2) use READWRITE or NOFILTER, depending on your needs
(3) specify an INTO TABLE result.


Whew. A lot of nit-picky discussion on a fine point. As part of the
Rushmore and SQL parsing engine processing, speed is a high priority.
Where something can be done in memory in nanoseconds, that's preferred
to network access in microseconds, and that's preferred to disk drive
access in milliseconds.

-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/cacw6n4swtcl3psqid2iq76nxyt9k-fkhv+8twlvrogadk3a...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to