Hi,
I am currently developing a resource scheduler. The table that outputs each
schedule has 24 rows on the left: 12 hours with half-hour increments. There
are 7 columns on the top: one for each day of the week. Total, there will
be 24*7=168 different cells which need to be populated with events if there
are any.
There are two different ways to accomplish this. One way is to do a query
to the database in each and every cell, but 168 queries is a tremendous
amount of queries for one page load. If there are 10 events in the
database, the page load is about 600 ms with SQL Server.
The second way to accomplish this is do have a master query at the top of
the page that retrieves each and every element in the database relevant to
the current page. Then, within each cell, do a CFOUTPUT or CFLOOP through
the query, and if the data is the one we want, output the results. This
way, if there are 10 events in the database, and there are 168 loops (one
loop for each cell), there is a total of 168*10=1680 times the if statement
(and possibly the code within the if statement) is executed. Overall, the
page load of this way is about 700 ms with SQL Server, with about 10-20 ms
added for each event added into the database.
The first way is definately better for page load and scalability, but it is
not very efficient to have 168 queries for a single page load. Does anyone
have any comments about the two different ways or new ideas on how to
accomplish this project?
Thanks
-Brent
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists