Deepak Kumar Posted February 29, 2012 Posted February 29, 2012 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'); } ?>
dansmith65 Posted February 29, 2012 Posted February 29, 2012 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.
Deepak Kumar Posted February 29, 2012 Author Posted February 29, 2012 Thanks for concern. Table consists of 53 fields, but i am only using 2 fields which is needed. Although, it is slow.
Newbies Richard DarkMantis Clifford Posted February 29, 2012 Newbies Posted February 29, 2012 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).
dansmith65 Posted February 29, 2012 Posted February 29, 2012 The next step would be to time each section of you script so you know for sure where the delay comes from.
webko Posted February 29, 2012 Posted February 29, 2012 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?
Deepak Kumar Posted March 1, 2012 Author Posted March 1, 2012 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.
webko Posted March 1, 2012 Posted March 1, 2012 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
cbishop Posted January 7, 2020 Posted January 7, 2020 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.
Recommended Posts
This topic is 2058 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 accountSign in
Already have an account? Sign in here.
Sign In Now