Quantcast
Channel: Adobe Community: Message List - ColdFusion
Viewing all articles
Browse latest Browse all 21760

Re: Query of Search Results

$
0
0

To give you a short n sweet on QoQ, lets say I have a master query:

 

<cfquery name="allTheData" datasource="myDSN" cachewithin="#createTimeSpan( 0, 1, 0, 0 )#">

     SELECT

          p.FirstName,

          p.LastName

     FROM Persons AS P

     ORDER BY P.LastName ASC,

          P.FirstName ASC

</cfquery>

 

This queries the database for all the records, and then stores it into a server-controlled query cache for 1 hour (cachewithin attribute).  From there, I can perform a query on that cached query which runs at BLAZINGLY fast speeds, like

 

<cfquery name="Johns" dbtype="query">

     SELECT * FROM allTheData WHERE FirstName = 'John'

</cfquery>

 

<cfquery name="Js" dbtype="query">

     SELECT * FROM allTheData WHERE LastName LIKE 'J%'

</cfquery>

 

These 2 queries are run against the cached first query (allTheData) and come back VERY quickly (cause they don't hit the original database).  Just be careful!  You don't want to cache all the data if there is MASSIVE amounts of data or if that data changes frequently (as it'll take up lots of processing time, server resources and can become outdated)


Viewing all articles
Browse latest Browse all 21760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>