Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Slow Performance of FM-PHP API

Featured Replies

hi guys please help in this situation:

Scenario: I want to retrieve the records of a database having 90,000 records via PHP, but unable to do it.

How can i retrieve the complete records without any performance issue ?

I am using the code:

<?php

$layout='web';

$fetchLayout=$fm->newFindAllCommand($layout);

print_r($result=$fetchLayout->execute());

$values=$result->getRecords();

foreach($values as $recValues)

{

echo $test = $recValues->getField('make');

echo $instructorlist1=$recValues->getField('model');

echo $instructorlist2=$recValues->getField('year');

}

?>

Reduce the number of fields on the layout to only those you need for that specific query.

Do you know the max memory that PHP can use, on your server? I'm not sure if you're reaching this limit, but that's the only other thing I can think of.

  • Author

Thanks for concern.

Table consists of 53 fields, but i am only using 2 fields which is needed.

Although, it is slow.

  • Newbies

Well if you create a new layout just for those fields then it will increase the performance greatly as the way that FM Works is that it will retrieve ALL Fields and filter through the ones that you need (in a round about way).

The next step would be to time each section of you script so you know for sure where the delay comes from.

Depending on how much data is in the two fields on the special layout that has only those two fields... It still may be too much data to handle in one hit...

Is there a reason you need all 90K rows at once?

  • Author

Depending on how much data is in the two fields on the special layout that has only those two fields... It still may be too much data to handle in one hit...

Is there a reason you need all 90K rows at once?

I want to create a value list from the field, which has 90k records.

How many values are unique?

I'd probably create a value list in FileMaker and then call that - not sure how that's done in the API but it's fairly easy in FX.php

  • 7 years later...

If ExecuteSQL is available in your version of PHP, use PerformFMScript instead, and call ExecuteSQL, delivering the results in a flat table format.  This is much faster and more efficient than using the API to get the individual records, as each record will include metadata and bloat the overall return.

You can use a layout with one field on it (a global text field) to save and output the results for your PHP file to read.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.