[FX.php List] Which is faster?

Leo R. Lundgren leo at finalresort.org
Sat Sep 11 12:48:24 MDT 2010


Isn't it possible to create one query (in page 2) like the equivalent of SQL's "select foo from bar where id=1 or id=3 or id=4"? I.e. building a query that asks for the IDs that were submitted in the form.

That way you only fire one query to the database, and get back the relevant posts. Doing method #2 below isn't very clean, because you use the client as a holder of data, instead of using your own database. In a way I feel it's ugly.


11 sep 2010 kl. 20.40 skrev Bob Patin:

> 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
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list



-|

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


More information about the FX.php_List mailing list