[FX.php List] Which is faster?

Bob Patin bob at patin.com
Sat Sep 11 12:40:27 MDT 2010


I'm working on a site where the user will be viewing a list of equipment, and checking a box for those pieces of equipment for which he wants service performed.

The list could contain a hundred or more items, and he may only need service on 2 or 3 items, or maybe 10.

So here are the 2 ways I've thought about doing this:

METHOD #1 (my preference so far):

1. For each item displayed, checkbox contains recid for that item; a FORM passes these checkboxes to page 2.

2. On page 2, a loop goes through the returned recids (unchecked items won't pass anything and will be ignored); it reads in the RECID, does a query, finds the item and displays it. 

3. Loop repeats through all the checkboxes containing a value, doing a query for each one.

DOWNSIDE: A single query for each item that needs service.
UPSIDE: I'm only passing a list of recids from page 1 to page 2.

METHOD #2

1. The FORM passes the item name, serial, type, and recid for each item displayed in the list; this might be a hundred items.

2. Page 2 receives this, and displays each of the items for which the checkbox was clicked. 

DOWNSIDE: I have to pass a huge chunk of data from page 1 to page 2; I don't know yet how many items each location will have, but it could be a hundred or more.

UPSIDE: No queries.

As I type this, method #2 seems faster, but my POST has to be pulled in and processed. Am I crazy to consider method #1, since method #2 doesn't require any database queries?

Thanks for your brilliant and pithy inputs as always, loyal FX users... 


Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
iChat: bobpatin
FileMaker 9, 10 & 11 Certified Developer
Member of FileMaker Business Alliance and FileMaker TechNet
--
Expert FileMaker Consulting 
FileMaker Hosting for all versions of FileMaker
PHP • Full email services • Free DNS hosting • Colocation • Consulting

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100911/bdafe82d/attachment.html


More information about the FX.php_List mailing list