Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

query that returns more than 1000 rows of data

Status
Not open for further replies.

jwdcfdeveloper

Programmer
Mar 20, 2001
170
0
0
US
Does anyone know how to prevent a cfquery tag from blowing up when a search returns more than 1000 rows of data?
 
What do you mean by "blow up"?

Are you sure you are not confusing the cfquery tag blowing up with the <cfoutput query=> tag? Assuming your server has sufficient ram/power etc and your sql is kosher, your cfquery tag shouldn't &quot;blow up&quot;. On the other hand, outputing a large record set to a client could have the appearance of something blowing up.

In the case of outputing a large amount of records, you will want to implement multiple pages to view the results.
 
No I mean that if I submit a query:

<cfquery name=&quot;getStuff&quot; datasource=&quot;someDB&quot;>
Select * From aTable Where condition = &quot;is met&quot;
</cfquery>

And the query returns more than 1000 Records (i.e. getStuff.RecordCount GTE 1000), what can you do to prevent an error page from popping up? Is there anything you can do w/ caching, or some other work around that will prevent the query from functioning?
 
make sure you add indexes to your tablefields where possible. Before you run the whole query, you might run a smaller query like:

<cfquery name=&quot;qGetNumber&quot;>
select count(your_primary_key_field) as NumberOfRecords from your_table
where condition = &quot;is met&quot;
</cfquery>

<cfif qGetNumber.NumberOfRecords LTE 1000>
... run the original query
<cfelse>
...errormessage
</cfif>

I'm not sure if it will make a big difference though.

chau
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top