Maximum to be exported.

I have a big database and do a selection by filter and then ,select all, and click Export.

For a “limited” number I get a download “Accounts.csv” and if I select a bigger number I get an error.

Where is the LIMIT in size or number ??

Thanks
William

Even after changing the 1000 upto 50000 it is still giving the same error.

I have changed the settings in apps\suitecrm\htdocs\config.php

‘resource_management’ =>
array (
‘special_query_limit’ => 50000,
‘special_query_modules’ =>
array (
0 => ‘Reports’,
1 => ‘Export’,
2 => ‘Import’,
3 => ‘Administration’,
4 => ‘Sync’,
),
‘default_limit’ => 1000, (changed this to 50000)
),

1 Like

You can try debugging the code to understand what it does.

The portion of code that verifies the config values can be found in include/resource/ResourceManager.php

	//Load config
	if(!empty($observer->module)) {
		$limit = 0;

		if(isset($GLOBALS['sugar_config']['resource_management'])) {
			   $res = $GLOBALS['sugar_config']['resource_management'];
			if(!empty($res['special_query_modules']) &&
			   in_array($observer->module, $res['special_query_modules']) &&
			   !empty($res['special_query_limit']) &&
			   is_int($res['special_query_limit']) &&
			   $res['special_query_limit'] > 0) {
			   $limit = $res['special_query_limit'];
			} else if(!empty($res['default_limit']) && is_int($res['default_limit']) && $res['default_limit'] > 0) {
			   $limit = $res['default_limit'];
			}
		} //if

		if($limit) {

		   $db = DBManagerFactory::getInstance();
		   $db->setQueryLimit($limit);
		   $observer->setLimit($limit);
		   $this->_observers[] = $observer;
		}
		return true;
	}

After this you can check DBManagerFactory to see if the limit is actually used or observer.

Unfortunately I don’t think it is an easy task and, personally I cannot be of further help because I don’t know the internals of this part of code.

Just to try more I went and looked at include/database/DBManager.php
Ther is a function:

	/**
	 * This function sets the query threshold limit
	 *
	 * @param int $limit value of query threshold limit
	 */
	public static function setQueryLimit($limit)
	{
		//reset the queryCount
		self::$queryCount = 0;
		self::$queryLimit = $limit;
	}

This function sets a variable called $query_limit whose default is 0.

Unfortunately I can’t find whre it is used.

Have you considered getting the export directly from the database (using phpMyAdmin or similar)?

If it’s a lot of data, it can be easier, and you might get additional control on your queries, cross-link several tables, etc.

One more thing: maybe the error that you get is not due to the limit in the query but in a low setting of max_execution_time in php.ini