Re: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-18 Thread Ajas Mohammed
Thanks Charlie... I think I have the necessary steps in place for query caching... I will check again and let you guys know...Anyway got chance to look at my second request? the link is here 
http://www.sitepoint.com/forums/showthread.php?t=428803Thanks again.Ajas.On 10/17/06, Charlie Arehart 
[EMAIL PROTECTED] wrote:




Ajas, you will get it to execute only once if you use 
CACHEDWITHIN and the SQL statement is the same. If you subsequently use the 
StartRow/MaxRows attributes in the CFOUTPUT QUERY loop, you'll still benefit 
from the previously cached result on subsequent next/prev pages. I do this in 
the code I have for the UGTV list/search interface.

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]] 
On Behalf Of Ajas MohammedSent: Monday, October 16, 2006 3:20 
PMTo: discussion@acfug.orgSubject: Re: [ACFUG Discuss] Re: 
PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing search 
Feature
Hi Charlie/Teddy, Thanks for the replies. I was in a meeting and just 
got chance to go thru your mail. you could store it in a session variable and use 
some indicator on the query string to tell the next/previous page that you mean 
to use the subset of dataI am thinking on this suggestion 
but wondering how I could access the results from the query EXECUTING IT ONLY 
ONCE i.e. next time I refer to that page it should a)execute query again but 
just give data from when I had left off i.e. if 1st page was 1-15 then 
second request should give 16-30 instead of running query again.b)do not 
execute query and I should be able display records from prev query only even 
though I will refer to that page by hyperlink next previous etc. By the 
way, I am using client variable to store the search word. Here you 
gocfif IsDefined (txtKeyword) 
cfset client.txtKeyword = 
txtKeyword/cfifSo 
next time when query is run, it will know what was the search keyword and run 
the querywhich brings us to another question... the query is going be the 
same for lets say N requests, but still I could see from the response time that 
its getting executing on every request... If I have confused anyone then 
please let me know and I will email in more 
detail.Thanks.Ajas.
On 10/16/06, Teddy 
Payne  [EMAIL PROTECTED] wrote:
Query 
  caching is one solution to alleviate the speed of the query execution. 
  There is the need to search page by page by a certain amount of records. 
  In an ad hoc solution, I have seen a second query that would perform a query 
  on the original source based upon a start point. The cfouput will 
  typically have a maxrows based upon the query of a query. For the 
  search criteria form, storing the criteria in a shared scope other always 
  helps. The goal would not to change the originating query in any 
  way otherwise the cache will be reset for a different combination. The 
  search criteria would need to exists in the query of the query. 
  Non-adhoc solutions include stored procedures that have increased 
  amounts of complexity to perform conditional queries that can be either 
  dynamically written or programatically built queries.Object Realtional 
  Mappers like Reactor for ColdFusion have a build in pagination scheme that 
  makes that sort of nice. I have not tested Reactor recently for the 
  notation, but I saw the object set for it. Teddy
  
  On 10/16/06, Charlie 
  Arehart  [EMAIL PROTECTED] 
  wrote:
  

Are 
folks reading my note below? Ajas, please clarify if I have understood your 
need correctly. I had just gone through the same dilemma on my UGTV site. I 
had done a similar next/prev link, but if the user had entered search 
criteria, I was challenged because I needed to carry that search criteria to 
the next screen. So this was about more than just simple query caching but 
indeed about carrying the search criteria (from a form value obtained on the 
first result page) to subsequent next/previous pages.

If this isn't the challenge 
you're trying to solve as well, my apologies. But if it is, I hope folks 
will see that there's more to it than just the general issues of query 
caching.

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto:
 [EMAIL PROTECTED]] On 
Behalf Of Charlie ArehartSent: Monday, October 16, 2006 11:13 
AMTo: discussion@acfug.orgSubject: RE: [ACFUG 
Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing 
search Feature


Ajas, I 
think you confused people with the subject saying please disregard previous 
email.

As for 
your challenge, your challenge isn't with caching but simplythat you 
needthe next or previous pages to know that you are still 
workingonthe subset of searched data. Youhave a couple of 
choices. You could pass your search criteria from page to page in the query 
string, or you could store it in a session variable

RE: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-17 Thread Charlie Arehart



Ajas, you will get it to execute only once if you use 
CACHEDWITHIN and the SQL statement is the same. If you subsequently use the 
StartRow/MaxRows attributes in the CFOUTPUT QUERY loop, you'll still benefit 
from the previously cached result on subsequent next/prev pages. I do this in 
the code I have for the UGTV list/search interface.

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
On Behalf Of Ajas MohammedSent: Monday, October 16, 2006 3:20 
PMTo: discussion@acfug.orgSubject: Re: [ACFUG Discuss] Re: 
PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing search 
Feature
Hi Charlie/Teddy, Thanks for the replies. I was in a meeting and just 
got chance to go thru your mail. you could store it in a session variable and use 
some indicator on the query string to tell the next/previous page that you mean 
to use the subset of dataI am thinking on this suggestion 
but wondering how I could access the results from the query EXECUTING IT ONLY 
ONCE i.e. next time I refer to that page it should a)execute query again but 
just give data from when I had left off i.e. if 1st page was 1-15 then 
second request should give 16-30 instead of running query again.b)do not 
execute query and I should be able display records from prev query only even 
though I will refer to that page by hyperlink next previous etc. By the 
way, I am using client variable to store the search word. Here you 
gocfif IsDefined ("txtKeyword") 
cfset client.txtKeyword = 
txtKeyword/cfifSo 
next time when query is run, it will know what was the search keyword and run 
the querywhich brings us to another question... the query is going be the 
same for lets say N requests, but still I could see from the response time that 
its getting executing on every request... If I have confused anyone then 
please let me know and I will email in more 
detail.Thanks.Ajas.
On 10/16/06, Teddy 
Payne  [EMAIL PROTECTED] wrote:
Query 
  caching is one solution to alleviate the speed of the query execution. 
  There is the need to search page by page by a certain amount of records. 
  In an ad hoc solution, I have seen a second query that would perform a query 
  on the original source based upon a start point. The cfouput will 
  typically have a maxrows based upon the query of a query. For the 
  search criteria form, storing the criteria in a shared scope other always 
  helps. The goal would not to change the originating query in any 
  way otherwise the cache will be reset for a different combination. The 
  search criteria would need to exists in the query of the query. 
  Non-adhoc solutions include stored procedures that have increased 
  amounts of complexity to perform conditional queries that can be either 
  dynamically written or programatically built queries.Object Realtional 
  Mappers like Reactor for ColdFusion have a build in pagination scheme that 
  makes that sort of nice. I have not tested Reactor recently for the 
  notation, but I saw the object set for it. Teddy
  
  On 10/16/06, Charlie 
  Arehart  [EMAIL PROTECTED] 
  wrote:
  

Are 
folks reading my note below? Ajas, please clarify if I have understood your 
need correctly. I had just gone through the same dilemma on my UGTV site. I 
had done a similar next/prev link, but if the user had entered search 
criteria, I was challenged because I needed to carry that search criteria to 
the next screen. So this was about more than just simple query caching but 
indeed about carrying the search criteria (from a form value obtained on the 
first result page) to subsequent next/previous pages.

If this isn't the challenge 
you're trying to solve as well, my apologies. But if it is, I hope folks 
will see that there's more to it than just the general issues of query 
caching.

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On 
Behalf Of Charlie ArehartSent: Monday, October 16, 2006 11:13 
AMTo: discussion@acfug.orgSubject: RE: [ACFUG 
    Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing 
    search Feature


Ajas, I 
think you confused people with the subject saying "please disregard previous 
email".

As for 
your challenge, your challenge isn't with caching but simplythat you 
needthe "next" or "previous" pages to know that you are still 
workingonthe subset of searched data. Youhave a couple of 
choices. You could pass your search criteria from page to page in the query 
string, or you could store it in a session variable and use some indicator 
on the query string to tell the next/previous page that you mean to use the 
subset of data (which will then pull the search criteria from the session to 
run that in its SQL).

At that 
point, yes, you may want to use a cached res

Re: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-16 Thread Ajas Mohammed
No, I do not have cfqueryparam in any of my queries. For question no. 2, I have heard of verity but I am not sure what it does and if thats what is needed for performing search (like google).Thanks.
On 10/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:







For 
number 1: do you have a cfqueryparam in your query - from what I 
understand, this doesn't work with cached queries...

  -Original Message-From: [EMAIL PROTECTED]
 
  [mailto:[EMAIL PROTECTED]]On Behalf Of Ajas MohammedSent: 
  Monday, October 16, 2006 10:17 AMTo: 
  discussion@acfug.orgSubject: [ACFUG Discuss] Re: PLZ DISREGARD PREV 
  MAIL..1.Query Caching  2.Implementing search 
  FeatureGood Morning 
  everyone, 
  Just wondering if anyone has any ideas/suggestions for the 2 questions I had 
  asked??? I didnt see any reply which makes me think if it is very simple or if 
  its difficult / time consuming. Thanks,Ajas.
  On 10/13/06, Ajas 
  Mohammed [EMAIL PROTECTED] wrote:
  Hello 
everyone, I apologize for the earlier mail sent.. I dont know what happened 
and the incomplete message got 
sent. 
I have 2 questions.1) I have a search page which might return 1000's of 
records for a search/keyword. I have implemented Pagination i.e. showing 
NEXT / PREVIOUS (10) RECORDS at a 
time. My problem is that everytime I click on NEXT OR PREVIOUS, the query is getting 
executed all over again. I dont want the query to be run everytime NEXT/PREVIOUS link is clicked. I have this 
code to do the caching cfquery datasource=#client.dbname# 
name=StateRegs cachedwithin=#createTimeSpan
(0,2,13,0)#/cfquerycfoutput 
query=StateRegs group=Reg_Name startrow=#start# maxrows=#end# 
data shown heretda 
href="" + disp)#Next 
#next# records/a /td(this link basically takes to the same query 
page, but I have a url parameter action, which if set to search will run the 
query and display search results)/cfoutputSimilarly a 
link for previous records. In the coldfusion Administrator, ONLY SAVE CLASS FILES IS CHECKED AND MAXIMUM 
NUMBER OF CACHED QUERIES IS SET AS 
300.2. The second question is also long. So plz visit this 
URL...http://www.sitepoint.com/forums/showthread.php?t=428803 
Its about implementing multiple word 
search on a site and you have search for those words (maybe 3 or 5 or 
even more) in 4 tables.Thanks 
in advance... 
  Ajas.- 
  To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform
 
  For more info, see http://www.acfug.org/mailinglists 
  Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
  List hosted by FusionLink 
  - 




-

To unsubscribe from this list, manage your profile @ 

http://www.acfug.org?fa=login.edituserform



For more info, see http://www.acfug.org/mailinglists

Archive @ http://www.mail-archive.com/discussion%40acfug.org/

List hosted by FusionLink

-







-
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by FusionLink
-



Re: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-16 Thread Ajas Mohammed
Here is the query...cfquery datasource=#client.dbname# name=StateRegs cachedwithin=#createTimeSpan(0,2,13,0)#
  SELECT reg.Reg_ID, elig.Eligibility_No, note.Note_No, reas.Reason_No, reg.Reg_Name, reg.State,reg.MaxDuration, reg.Concurrent_Policies, reg.Link, elig.Eligibility_Text, reas.Reason_Text
, note.Note_Text FROM (( (Regulations reg left outer join Reason reas ON reg.Reg_ID = reas.Reason_Reg_ID and (reg.Reg_Name like '%#txtKeyword#%' or 
reg.MaxDuration like '%#txtKeyword#%' or reas.Reason_Text like '%#txtKeyword#%') ) left outer join Eligibility elig on reg.Reg_ID = elig.Elig_Reg_ID and elig.Eligibility_Text
 like '%#txtKeyword#%' ) left outer JOIN Notes note on reg.Reg_ID = note.Note_Reg_ID and note.Note_Text like '%#txtKeyword#%' ) WHERE 
reg.Country = 'US' cfif statelist IS NOT  and statelist IS NOT ALL AND reg.State = '#statelist#' /
cfif  /cfqueryI am sorry if doesnt look indented.
Thanks.On 10/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED]
 wrote:






if you 
paste the query in here we may be able to help...there are a few things that 
will cause a query NOT to be cached

  -Original Message-From: 
[EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]]On Behalf Of Ajas MohammedSent: 
  Monday, October 16, 2006 10:37 AMTo: 
  discussion@acfug.org
Subject: Re: [ACFUG Discuss] Re: PLZ DISREGARD 
  PREV MAIL..1.Query Caching  2.Implementing search 
  FeatureNo, I do not have cfqueryparam in any of 
  my queries. For question no. 2, I have heard of verity but I am not sure what 
  it does and if thats what is needed for performing search (like 
  google).Thanks.
  On 10/16/06, [EMAIL PROTECTED] 
[EMAIL PROTECTED] wrote:
  

For number 1: do you have a 
cfqueryparam in your query - from what I understand, this doesn't 
work with cached queries...

  
  -Original 
  Message-From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]]On 
  Behalf Of Ajas MohammedSent: Monday, October 16, 2006 10:17 
  AMTo: discussion@acfug.orgSubject: [ACFUG Discuss] 
  Re: PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing search 
  FeatureGood Morning 
  everyone, 
  Just wondering if anyone has any ideas/suggestions for the 2 questions I 
  had asked??? I didnt see any reply which makes me think if it is very 
  simple or if its difficult / time consuming. 
  Thanks,Ajas.
  On 10/13/06, Ajas 
  Mohammed [EMAIL PROTECTED] 
  wrote: 
  Hello 
everyone, I apologize for the earlier mail sent.. I dont know what 
happened and the incomplete message got 
sent. 
I have 2 questions.1) I have a search page which might return 1000's 
of records for a search/keyword. I have implemented Pagination i.e. 
showing NEXT / PREVIOUS (10) 
RECORDS at a time. My problem is that everytime I click on NEXT OR PREVIOUS, the query is getting 
executed all over again. I dont want the query to be run everytime NEXT/PREVIOUS link is clicked. I have 
this code to do the caching cfquery datasource=#client.dbname# 
name=StateRegs cachedwithin=#createTimeSpan 
(0,2,13,0)#/cfquerycfoutput 
query=StateRegs group=Reg_Name startrow=#start# 
maxrows=#end# data shown heretda 
href="" + 
disp)#Next #next# records/a /td(this link basically takes to the same query 
page, but I have a url parameter action, which if set to search will run 
the query and display search 
results)/cfoutputSimilarly a link for previous 
records. In the coldfusion Administrator, ONLY SAVE CLASS FILES IS CHECKED AND MAXIMUM 
NUMBER OF CACHED QUERIES IS SET AS 
300.2. The second question is also long. So plz visit 
this URL...http://www.sitepoint.com/forums/showthread.php?t=428803 
Its about implementing multiple 
word search on a site and you have search for those words (maybe 
3 or 5 or even more) in 4 
tables.Thanks in advance... 
  Ajas.- 
  To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform 
For 
  more info, see http://www.acfug.org/mailinglists Archive @ 
http://www.mail-archive.com/discussion%40acfug.org/ 
  List hosted by FusionLink 
  - 
- 
To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform
 For 
more info, see http://www.acfug.org/mailinglists Archive @ 
http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink 
- 
  - 
  To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform
 
  For more 

RE: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-16 Thread axunderwood



if you 
paste the query in here we may be able to help...there are a few things that 
will cause a query NOT to be cached

  -Original Message-From: [EMAIL PROTECTED] 
  [mailto:[EMAIL PROTECTED]On Behalf Of Ajas MohammedSent: 
  Monday, October 16, 2006 10:37 AMTo: 
  discussion@acfug.orgSubject: Re: [ACFUG Discuss] Re: PLZ DISREGARD 
  PREV MAIL..1.Query Caching  2.Implementing search 
  FeatureNo, I do not have cfqueryparam in any of 
  my queries. For question no. 2, I have heard of verity but I am not sure what 
  it does and if thats what is needed for performing search (like 
  google).Thanks.
  On 10/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  

For number 1: do you have a 
cfqueryparam in your query - from what I understand, this doesn't 
work with cached queries...

  
  -Original 
  Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On 
  Behalf Of Ajas MohammedSent: Monday, October 16, 2006 10:17 
  AMTo: discussion@acfug.orgSubject: [ACFUG Discuss] 
  Re: PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing search 
  FeatureGood Morning 
  everyone, 
  Just wondering if anyone has any ideas/suggestions for the 2 questions I 
  had asked??? I didnt see any reply which makes me think if it is very 
  simple or if its difficult / time consuming. 
  Thanks,Ajas.
  On 10/13/06, Ajas 
  Mohammed [EMAIL PROTECTED] 
  wrote: 
  Hello 
everyone, I apologize for the earlier mail sent.. I dont know what 
happened and the incomplete message got 
sent. 
I have 2 questions.1) I have a search page which might return 1000's 
of records for a search/keyword. I have implemented Pagination i.e. 
showing NEXT / PREVIOUS (10) 
RECORDS at a time. My problem is that everytime I click on NEXT OR PREVIOUS, the query is getting 
executed all over again. I dont want the query to be run everytime NEXT/PREVIOUS link is clicked. I have 
this code to do the caching cfquery datasource="#client.dbname#" 
name="StateRegs" cachedwithin="#createTimeSpan 
(0,2,13,0)#"/cfquerycfoutput 
query="StateRegs" group="Reg_Name" startrow="#start#" 
maxrows="#end#" data shown heretda 
href=""start + 
disp")#"Next #next# records/a /td(this link basically takes to the same query 
page, but I have a url parameter action, which if set to search will run 
the query and display search 
results)/cfoutputSimilarly a link for previous 
records. In the coldfusion Administrator, ONLY SAVE CLASS FILES IS CHECKED AND MAXIMUM 
NUMBER OF CACHED QUERIES IS SET AS 
300.2. The second question is also long. So plz visit 
this URL...http://www.sitepoint.com/forums/showthread.php?t=428803 
Its about implementing multiple 
word search on a site and you have search for those words (maybe 
3 or 5 or even more) in 4 
tables.Thanks in advance... 
  Ajas.- 
  To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For 
  more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
  List hosted by FusionLink 
  - 
- 
To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform For 
more info, see http://www.acfug.org/mailinglists Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
List hosted by FusionLink 
- 
  - 
  To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform 
  For more info, see http://www.acfug.org/mailinglists 
  Archive @ http://www.mail-archive.com/discussion%40acfug.org/ 
  List hosted by FusionLink 
  - 




-

To unsubscribe from this list, manage your profile @ 

http://www.acfug.org?fa=login.edituserform



For more info, see http://www.acfug.org/mailinglists

Archive @ http://www.mail-archive.com/discussion%40acfug.org/

List hosted by FusionLink

-




Re: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-16 Thread Teddy Payne
Query caching is one solution to alleviate the speed of the query execution. There is the need to search page by page by a certain amount of records. In an ad hoc solution, I have seen a second query that would perform a query on the original source based upon a start point. The cfouput will typically have a maxrows based upon the query of a query.
For the search criteria form, storing the criteria in a shared scope other always helps. The goal would not to change the originating query in any way otherwise the cache will be reset for a different combination. The search criteria would need to exists in the query of the query. 
Non-adhoc solutions include stored procedures that have increased amounts of complexity to perform conditional queries that can be either dynamically written or programatically built queries.Object Realtional Mappers like Reactor for ColdFusion have a build in pagination scheme that makes that sort of nice. I have not tested Reactor recently for the notation, but I saw the object set for it.
TeddyOn 10/16/06, Charlie Arehart [EMAIL PROTECTED] wrote:





Are folks reading my note below? Ajas, please clarify if I 
have understood your need correctly. I had just gone through the same dilemma on 
my UGTV site. I had done a similar next/prev link, but if the user had entered 
search criteria, I was challenged because I needed to carry that search criteria 
to the next screen. So this was about more than just simple query caching but 
indeed about carrying the search criteria (from a form value obtained on the 
first result page) to subsequent next/previous pages.

If 
this isn't the challenge you're trying to solve as well, my apologies. But if it 
is, I hope folks will see that there's more to it than just the general issues 
of query caching.

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]] 
On Behalf Of Charlie ArehartSent: Monday, October 16, 2006 
11:13 AMTo: discussion@acfug.orgSubject: RE: [ACFUG 
Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing 
search Feature

Ajas, I think you confused people with the subject saying 
please disregard previous email.

As for your challenge, your challenge isn't with caching 
but simplythat you needthe next or previous pages to know that 
you are still workingonthe subset of searched data. Youhave a 
couple of choices. You could pass your search criteria from page to page in the 
query string, or you could store it in a session variable and use some indicator 
on the query string to tell the next/previous page that you mean to use the 
subset of data (which will then pull the search criteria from the session to run 
that in its SQL).

At that point, yes, you may want to use a cached result. 
Since the cache is per the SQL used, if you have the search string in the query 
and you'd previously run that same query within the cachedwithin time, then you 
will benefit from the cache. 

As always, something to be careful with in caching is that 
your underlying data may change as the user is browsing the searched results. 
You need to pick a cachedwithin time that balances the cost of doing repeated 
queries against the cost of getting inaccurate data. Only you can know what's 
best. Some may know that you can flush the query cache, but only all cached 
results in the entire application, not just one, using CFOBJECTCACHE 
Action="" 

BTW, query caching has nothing to do withthe 
save class files option, though yes the max cached queries does indeed 
limit how many cached query results (cachedwithin and cachedafter) you can have 
at one time (across the entire server).

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto:
[EMAIL PROTECTED]] 
On Behalf Of Ajas MohammedSent: Monday, October 16, 2006 10:17 
AMTo: discussion@acfug.orgSubject: [ACFUG Discuss] Re: PLZ 
DISREGARD PREV MAIL..1.Query Caching  2.Implementing search 
Feature
Good Morning 
everyone, 
Just wondering if anyone has any ideas/suggestions for the 2 questions I had 
asked??? I didnt see any reply which makes me think if it is very simple or if 
its difficult / time consuming. Thanks,Ajas.
On 10/13/06, Ajas 
Mohammed [EMAIL PROTECTED] 
wrote: 
Hello 
  everyone, I apologize for the earlier mail sent.. I dont know what happened 
  and the incomplete message got 
  sent. 
  I have 2 questions.1) I have a search page which might return 1000's of 
  records for a search/keyword. I have implemented Pagination i.e. showing NEXT / PREVIOUS (10) RECORDS at a time. My 
  problem is that everytime I click on NEXT OR 
  PREVIOUS, the query is getting executed all over again. I dont want the 
  query to be run everytime NEXT/PREVIOUS 
  link is clicked. I have this code to do the caching cfquery 
  datasource=#client.dbname# name=StateRegs cachedwithin=#createTimeSpan 
  (0,2,13,0)#/cfquerycfoutput 
  query=StateRegs group=Reg_Name startrow=#start# maxrows=#end# 
  data shown heretda 
  href="

Re: [ACFUG Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching 2.Implementing search Feature

2006-10-16 Thread Ajas Mohammed
Hi Charlie/Teddy, Thanks for the replies. I was in a meeting and just got chance to go thru your mail. you could store it in a session variable and use some indicator 
on the query string to tell the next/previous page that you mean to use the 
subset of dataI am thinking on this suggestion but wondering how I could access the results from the query EXECUTING IT ONLY ONCE i.e. next time I refer to that page it should a)execute query again but just give data from when I had left off 
i.e. if 1st page was 1-15 then second request should give 16-30 instead of running query again.b)do not execute query and I should be able display records from prev query only even though I will refer to that page by hyperlink next previous etc.
By the way, I am using client variable to store the search word. Here you gocfif IsDefined
(txtKeyword) cfset client.txtKeyword = txtKeyword/cfifSo next time when query is run, it will know what was the search keyword and run the querywhich brings us to another question... the query is going be the same for lets say N requests, but still I could see from the response time that its getting executing on every request...
If I have confused anyone then please let me know and I will email in more detail.Thanks.Ajas.On 10/16/06, Teddy Payne 
[EMAIL PROTECTED] wrote:Query caching is one solution to alleviate the speed of the query execution. There is the need to search page by page by a certain amount of records. In an ad hoc solution, I have seen a second query that would perform a query on the original source based upon a start point. The cfouput will typically have a maxrows based upon the query of a query.
For the search criteria form, storing the criteria in a shared scope other always helps. The goal would not to change the originating query in any way otherwise the cache will be reset for a different combination. The search criteria would need to exists in the query of the query. 
Non-adhoc solutions include stored procedures that have increased amounts of complexity to perform conditional queries that can be either dynamically written or programatically built queries.Object Realtional Mappers like Reactor for ColdFusion have a build in pagination scheme that makes that sort of nice. I have not tested Reactor recently for the notation, but I saw the object set for it.
TeddyOn 10/16/06, Charlie Arehart 
[EMAIL PROTECTED] wrote:





Are folks reading my note below? Ajas, please clarify if I 
have understood your need correctly. I had just gone through the same dilemma on 
my UGTV site. I had done a similar next/prev link, but if the user had entered 
search criteria, I was challenged because I needed to carry that search criteria 
to the next screen. So this was about more than just simple query caching but 
indeed about carrying the search criteria (from a form value obtained on the 
first result page) to subsequent next/previous pages.

If 
this isn't the challenge you're trying to solve as well, my apologies. But if it 
is, I hope folks will see that there's more to it than just the general issues 
of query caching.

/charlie
http://www.carehart.org/blog/



From: [EMAIL PROTECTED] [mailto:

[EMAIL PROTECTED]] 
On Behalf Of Charlie ArehartSent: Monday, October 16, 2006 
11:13 AMTo: discussion@acfug.orgSubject: RE: [ACFUG 
Discuss] Re: PLZ DISREGARD PREV MAIL..1.Query Caching  2.Implementing 
search Feature

Ajas, I think you confused people with the subject saying 
please disregard previous email.

As for your challenge, your challenge isn't with caching 
but simplythat you needthe next or previous pages to know that 
you are still workingonthe subset of searched data. Youhave a 
couple of choices. You could pass your search criteria from page to page in the 
query string, or you could store it in a session variable and use some indicator 
on the query string to tell the next/previous page that you mean to use the 
subset of data (which will then pull the search criteria from the session to run 
that in its SQL).

At that point, yes, you may want to use a cached result. 
Since the cache is per the SQL used, if you have the search string in the query 
and you'd previously run that same query within the cachedwithin time, then you 
will benefit from the cache. 

As always, something to be careful with in caching is that 
your underlying data may change as the user is browsing the searched results. 
You need to pick a cachedwithin time that balances the cost of doing repeated 
queries against the cost of getting inaccurate data. Only you can know what's 
best. Some may know that you can flush the query cache, but only all cached 
results in the entire application, not just one, using CFOBJECTCACHE 
Action="" 

BTW, query caching has nothing to do withthe 
save class files option, though yes the max cached queries does indeed 
limit how many cached query results (cachedwithin and cachedafter) you can have 
at one time (across the entire server).

/charlie
http://www.carehar