Jump to content

Slow Performance of FM-PHP API


This topic is 1565 days old. Please don't post here. Open a new topic instead.

Recommended Posts

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');

}

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 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.

Link to comment
Share on other sites

This topic is 1565 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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