It would depend a lot on how you're using the information now, that is, how
people are accessing it. Structures (particularly nested structures) are
great for drill down information. But if you're doing a lot of looping,
then queries might be faster.
What might work is the nested structure like:
APPLICATION.newark["Access Control Systems"] = an ordered array of listings
(You can use "non-standard" key names provided you build and access the
structure using array notation. I.e., APPLICATION.newark.Access Control
Systems would not work.)
You *can* loop over structures, either as a collection, or by pulling the
keys with a StructKeyList(). I've done some sites where I kept a good
portion of the "common" information in large hierarchical structures that I
used all over the site. Sometimes I looped over the structure, sometimes I
pulled detailed information from several layers into the structure. I
liked having one place for all the information. But if I didn't need the
information in a structure, I'm just as happy saving a query or two to
APPLICATION scope.
If you have more detailed information about what you're trying to
accomplish, I can give you some more ideas.
Sharon
At 06:47 PM 9/1/2000 -0700, paul smith wrote:
>Thanks for jumping in, Sharon. Good suggestions.
>
>In just a few minutes mulling over your ideas, I've
>come up with some possibilities.
>
>My app is a Yellow Pages.
>
>So one query I have been running is to list all
>Headings that start with "A" for example
>(Academies, Access Control Systems, Accessories-Fashion,
>and so forth...)
>
>So your approach would be to load all Headings that begin
>with A into a structure, all those that begin with B
>into another structure, and so forth. Right? This
>eliminates a call to the DB.
>
>Another would be to load all Listings in one city, say
>New York into a structure, all Listings in Newark into
>another structure, and so forth.
>
>Is this the idea? Do you have any specific suggestions
>for Yellow Pages?
>
>best, paul
>
>
>At 09:18 PM 9/1/00 -0400, you wrote:
>>OK, gonna jump in on this one now.
>>
>>I don't use cached queries. I use scoped queries. Essentially the same
>>thing, but I like managing my own caching rather than allowing the server
>>to determine what gets cached (based on the rotating list of "last used").
>>Just a preference.
>>
>>But on the queries vs. structures discussion you're comparing apples and
>>oranges. If you have data that you're going to loop over and output, use a
>>query. That's what they're designed for. But if you're going to call
>>individual pieces of data (particularly organizationally nested pieces of
>>data) than use a structure, much quicker to point to exactly what you want
>>than to loop to find it.
>>
>>Example, a structure that holds school information:
>>
>>schools.schoolname.class.teacher = "[teachername]"
>>
>>In my code (where I know the school and class):
>>#schools[schoolname][class]["teacher"]# will output teacher name.
>>
>>I can pull this information out of a resident structure much quicker than
>>running a query, or even looping through a query to find the information I
>>want. This may not be the best example, but it may help to look at some of
>>the queries you're running to get complex information and see where a
>>nested structure (queried for and built once) saved into application scope
>>(then copied to request scope with cflock for usage) might be a better
>>alternative.
>>
>>I *love* structures and I'm open to any questions on using them efficiently.
>>
>>Sharon
>>
>>P.S., <cfscript> rules for working with structures, whether it's faster or
>>not.
>>
>>--------------------------------------------------------------------------
----
>>Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
>>To Unsubscribe visit
>>http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
>>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>>the body.
>
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.