[FX.php List] FindAll search is slow !!

DC dan.cynosure at dbmscan.com
Mon Jan 30 09:16:14 MST 2006


Try this: ( archived at http://www.dbmscan.com/snippets/ )

<?php
// if the script you call here takes a long time to execute
// then, the FX.php code hangs and reports an error
// the script still happened (most likely) but, FX timed out
$which_script = (isset($_REQUEST['script'])) ? $_REQUEST['script']:'';
//exit();
// default db and layout to utility file
// so  we can use this easily with remote script calling
$which_db = (isset($_REQUEST['db'])) ? $_REQUEST['db']:'default_db.fp5';

$which_layout = (isset($_REQUEST['layout'])) ? 
$_REQUEST['layout']:'defaultlayout';

// run an FMP script by sending it in the GET/POST query
// include the FX.php files
include_once("/path/to/FX.php");
//  prefs for FX.php are stored separately, database location, port, pass

include_once("/path/to/myFXprefs.php");
$request = new FX ($serverIP, $port);
// set the password for db
$fmpass='mypassword';
// build a New request
// should target a layout with only the fields we need
$request->SetDBData($which_db, $which_layout);

// the database is password protected
$request->SetDBPassword ($fmpass);

// run a script to run post find
$request->AddDBParam ('-script', $which_script);

// call the action by calling FMFindAny()
$findany_record_array = $request-> FMFindAny();

// display the results
prewrap($findany_record_array);

// should have some confirmation that the script is executing

//-------------------------------------------
// DESCRIPTION: print data to browser with <pre> tags
//

function prewrap ($array) {
     echo '<pre>';
         print_r($array);
     echo '</pre>';
}

?>

Laura Long had written:
> How do I trigger a script in the FM database after a new record is
> created through php?  Thanks...
> 
> Laura Long
> Database/Web Designer
> 
> 
> -----Original Message-----
> From: fx.php_list-bounces at mail.iviking.org
> [mailto:fx.php_list-bounces at mail.iviking.org] On Behalf Of Ankur Goyal
> Sent: Thursday, January 26, 2006 6:41 PM
> To: FX.php Discussion List
> Subject: Re: [FX.php List] FindAll search is slow !!
> 
> 
> I used "FX Parser", I specified the same layout and only 100 records  
> first time. Search wasn't too bad, only took few seconds. But when I  
> increased the number to "1000", it was really slow, literally few  
> mins !!!
> 
> Is that mean, it's a FileMaker problem ?? the way it sends the data  
> is really slow ?
> 
> Please provide me some guidance/comments.
> 
> Thanks !
> 
> Ankur
> 
> On Jan 25, 2006, at 1:23 PM, Jason H Awbrey wrote:
> 
> 
>>To expand on Derrick's statement, I've noticed speed issues with
>>files that have complex relational structures, i.e. multi-predicate  
>>relationships and the like, causing similar problems. The problem  
>>lies with FileMaker, not FX.php. If you perform the XML query  
>>against FileMaker you'll probably notice a time delay in the  
>>returned dataset. Simplification, like Derrick said, is the key --  
>>not only in limiting what FM is returning, but through what  
>>relationships FM is returning data.
>>
>>HTH,
>>Jason
>>
>>~-~-~-~~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
>>Jason Awbrey
>>Web Integration
>>FileMaker 7 Certified Developer
>>Harmonic Data Associates
>>http://www.harmonic-data.com
>>jawbrey at harmonic-data.com ~-~-~-~~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
>>
>>
>>
>>On Jan 25, 2006, at 2:46 PM, Derrick Fogle wrote:
>>
>>
>>>The overhead is probably in the transfer of the data out of FMP  
>>>into PHP. How many fields do you have, and how much data is in,  
>>>the fields on the layout you are using? Make sure your layout  
>>>doesn't have any more fields or data than absolutely necessary.
>>>
>>>I've got a DB with nearly 100,000 records in it. A search and  
>>>return of 100 records is nearly instant. A return of 5,000 records  
>>>takes 10-15 seconds. A return of 25,000 records takes about a minute.
>>>
>>>I've only got 5 fields on the layout, and each total record size  
>>>averages about 50 characters, with an max of about 300 characters.
>>>
>>>On Jan 25, 2006, at 2:18 PM, Ankur Goyal wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>I have a database with 7250 records. I have a search page with a  
>>>>set of fields, when I do a search on a specific field, the  
>>>>results come pretty fast, but when I do a "find all" search, it  
>>>>is really slow !! (sometimes take 1-2 mins)
>>>>I checked the database, and "Find All" search is pretty fast  
>>>>there ...so I am not sure, if my PHP code is making things slow !!
>>>>Once I get the data from the database, I'm doing a set of  
>>>>calculations with PHP in-order to display that data in a specific  
>>>>way to my users.
>>>>
>>>>Please provide me some guidance/recommendation...I am not sure,  
>>>>what's making it slow ??
>>>>
>>>>Thanks !
>>>>
>>>>Ankur
>>>>_______________________________________________
>>>>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
>>>
>>>
>>>
>>>_______________________________________________
>>>FX.php_List mailing list
>>>FX.php_List at mail.iviking.org
>>>http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>>
>>
>>
>>
>>
>>
>>_______________________________________________
>>FX.php_List mailing list
>>FX.php_List at mail.iviking.org
>>http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 


More information about the FX.php_List mailing list