[FX.php List] Update a field in all related records.

Derrick Fogle derrick at fogles.net
Fri Mar 17 12:22:20 MST 2006


I'm running FM7SA on a relatively weak box: Dual 1.4Ghz G4 with high- 
speed SCSI drives. I've done enough testing to determine that the  
FASTEST fx.php call ends up taking almost a half second. Then add all  
the time it takes to return lots of data. My FX.php setup can only  
process slightly more than one FX transaction to FM per second.  
But... I would bet that even on the hottest iron, you're only going  
to get 4 transactions per second throughput.

Then, add the fact that every record DOES have to be touched  
individually... no "UPDATE xxx SET yyy=zzz WHERE qqq=ppp" that can  
alter a whole batch of records with a single transaction.

FM may shine as a workgroup database application, but it is a lame  
dog as a back-end DB for web content. It works for me because the  
primary DB application is a workgroup where FM makes sense, and I  
only have to bring a few parts of the database to the web. All the  
instances where I need to call or modify a batch of child records  
related to the parent, I can do with a single transaction and portals.

Have you (sorry I don't know who actually asked the question to begin  
with anymore - this isn't directed at Greg) tried using a portal from  
the parent record to update the child records? You can update portal  
data the same way to call it, with incrementing array numbers. It's  
either that or the script method.


On Mar 17, 2006, at 12:56 PM, Greg Lane wrote:

> PHP scripts are very fast. The problem occurs when you have to send  
> a lot of requests to FMSA. For instance, if you want to delete or  
> modify a found set of records, FX.php (and FMSA's XML interface)  
> require you to make a separate request for each record. The  
> overhead of each of these requests can cause the PHP script's  
> performance to suffer. However, in some cases you can accomplish  
> the same thing with a single request by performing an FM script.
>
> Consider a case where you want to delete all account records where  
> status="expired". You could have your PHP script find all of the  
> records where status="expired" and then loop through those records,  
> sending an FMDelete for each one. That works fine for a few  
> records, but it doesn't scale well. A better option would be to use  
> a "Delete All" FM script with an FMFind. A safer option might be to  
> encapsulate all of the logic into a "Delete Expired Accounts" FM  
> script which goes to an appropriate layout, finds expired records,  
> and deletes them. Then perform that script with an FMFindAny. You  
> can also have the script pass a result back to FX.php through a  
> global so you know if the script executed successfully.
>
> My rule of thumb is that if I find a situation where I need to make  
> FX.php calls within a loop, I try to find a better way. This  
> becomes even more important if your web server and FMSA server are  
> in separate locations. The extra latency can really add up.
>
> Greg
>
> On Mar 16, 2006, at 11:22 PM, Joel Shapiro wrote:
>
>> I'm surprised (pleasantly!) to hear that calling an FM script  
>> could have better performance than having PHP do all the  
>> processing.  I've got a project doing something similar to Joe's  
>> task, and I use an FM script, but I'd thought I was just being  
>> lazy and that an "all PHP" solution would be faster/stronger/more  
>> reliable... (and that maybe I'd get around to switching it someday ;)
>>
>> Are there any guidelines or 'rules of thumb' about when using a  
>> FileMaker script is preferable to PHP scripting?
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list


Derrick Fogle
derrick at fogles.net





More information about the FX.php_List mailing list