Bummer...I think.

If QoQ doesn't provide a performance improvement
over database access, then I'm back to where I started.

Thanks for the explanation!


-----Original Message-----
From: Dave Watts [mailto:dwa...@figleaf.com] 
Sent: Thursday, January 06, 2011 1:25 PM
To: cf-talk
Subject: Re: Accessing a cached query in one function from another...


> So, to be able to run a "master query" that would
> essentially be an in-memory stand-in for the data
> on the database, and be able to run *various* types
> of queries on that data, rather than the exact same
> query, I would need to put the "master query" into
> a persistent scope.  Right?

Yes, although I'm not sure you really want to do that. Query of query
functionality is fairly slow, so I wouldn't turn to that as a
performance enhancement.

> Or, perhaps, to be able to run *various* queries on the
> "master query", I would need utilized a query-of-query
> setup with "master query" stored in memory?

I'm not sure how this differs from your previous statement. Everything
that you can get to is stored in memory. Persistent scopes are in
memory, cached queries using CACHEDWITHIN/CACHEDAFTER are in memory.
Even variables local to a page, request or even a function are stored
in memory - the only question is, how long are they stored?

> I guess at this point, I'm uncertain of the difference
> between utilizing a "cachedWithin" query as opposed to
> a "query-of-query"...

CACHEDWITHIN and CACHEDAFTER let you store a query in memory so that
the next time the same CFQUERY tag is run, CF can just provide the
data directly rather than going to the database to get it. Again,
though, it doesn't create a variable that you can access
programmatically. The advantage of this approach is that you can just
add caching attributes to your CFQUERY tags without making other code
changes, and that can improve the speed of your application
significantly.

If you want to store a query in a variable that you can access, you
simply put the query in the appropriate scope. Then, you can reference
that variable however you like.

Query of query functionality allows you to reference a query variable
as if it were a database table. The query variable has to exist first,
which either means you've run a query within that request or you have
one stored in another scope somewhere. Query of query isn't intended
to improve performance as much as to give you another way to
manipulate data. It doesn't matter where that data comes from, though
- it could come from a query cached using caching attributes as long
as you have that query in the same page, or it could come from a query
you've stored in a persistent scope.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340531
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to