DB Error: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECT=1 or SET MAX_JOIN_SIZE=#if the SELECT is okay

I encountered this error when I’m Testing it Online in the editor section.

Hi @msanting

What is OJS version are you testing? What action have you taken before see this message?

Regards,
Israel Cefrin
Public Knowledge Project Team

Hi @msanting,
One of the cause may be a restriction in the “MySQL row-size limit” of your server.

Can you look into this post and the discussions there for the same problem I faced last year?

Regards,
@anupent

nothing. We are conducting a testing if all the process is OK. in the editor side when i click the Unassigned,In Review and In Editing I’ve got that error . the we used is version is ojs-2.4.8-2 the stable version.

Hi @msanting,

Most of the free hosting will one or another restriction, though they claim unlimited.

And, almost all of the paid hosting will not have those restrictions.

You can ask your hosting provider about their “MySQL row-size limit”, if any.

Regards,

Hi @anupent
Thank you for your time and helping. We are now waiting for their reply our (hosting provider).

Regards,

Where and how to check “MySQL row-size limit” and where to change value for MAX_JOIN_SIZE. I have got problem with loading Users in OJS 3.1.2 and receive error with DR Error: MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay
Regards,
Lazar

Any idea to solve problem with DR Error: MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET MAX_JOIN_SIZE=# if the SELECT is okay?

What query is causing this error?

Loading Users list.
image
Cannot access to Users list. Did all recommendation, consult provider, update to last version… nothing.

Out of curiosity, how many users do you have in your site?

As I can see from table Users in database - 808

That certainly isn’t a large number of users. I know of installs with tens of thousands.

Do you know what your current value of “MAX_JOIN_SIZE” is? You may be able to query it with:

show variables where variable_name = 'max_join_size';

“MAX_JOIN_SIZE” is 4194304

That is surprisingly small. Default MySQL/MariaDB 5.5+ ships with the default as the maximum value:
18446744073709551615

For 5.4 and prior, this value was:
4294967295

Your value is 1/1000th of this, if my math is correct?

On the other hand, why are 800 users returning a recordset of 4 million rows, I wonder?

How to change this value?

This will depend on your server type. If you are self-hosted, you will likely change this value in your mysql .ini or .cnf file; if you are on a shared host, you might change this through a CPanel tool or .htaccess directive. Check with your system administrator or hosting provider for details.

Hello all! I have been chasing the same issue and i think it boils down to /htdocs/lib/pkp/classes/security/RoleDao.inc.php (lines 93 through 109, at least in OJS 3.0.2-3, which is what i am using), there the following SQL query is being created (the numbers are the row count for each table):

SELECT DISTINCT
u.*,
COALESCE(ugl.setting_value, ugpl.setting_value) AS user_given,
CASE WHEN ugl.setting_value <> ‘’ THEN ufl.setting_value ELSE ufpl.setting_value END AS user_family
FROM
users AS u --17
LEFT JOIN user_user_groups uug ON (uug.user_id = u.user_id) --23
LEFT JOIN user_groups ug ON (ug.user_group_id = uug.user_group_id) --18
LEFT JOIN controlled_vocabs cv ON (cv.assoc_type = 4096 AND cv.assoc_id = u.user_id AND cv.symbolic = ‘interest’) --183
LEFT JOIN user_settings usgs ON (usgs.user_id = u.user_id AND usgs.setting_name = ‘givenName’) --87
LEFT JOIN user_settings usfs ON (usfs.user_id = u.user_id AND usfs.setting_name = ‘familyName’) --87
LEFT JOIN controlled_vocab_entries cve ON (cve.controlled_vocab_id = cv.controlled_vocab_id) --142
LEFT JOIN controlled_vocab_entry_settings cves ON (cves.controlled_vocab_entry_id = cve.controlled_vocab_entry_id) --149
LEFT JOIN user_settings ugl ON (u.user_id = ugl.user_id AND ugl.setting_name = ‘givenName’ AND ugl.locale = ‘es_ES’) --87
LEFT JOIN user_settings ugpl ON (u.user_id = ugpl.user_id AND ugpl.setting_name = ‘givenName’ AND ugpl.locale = ‘es_ES’) --87
LEFT JOIN user_settings ufl ON (u.user_id = ufl.user_id AND ufl.setting_name = ‘familyName’ AND ufl.locale = ‘es_ES’) --87
LEFT JOIN user_settings ufpl ON (u.user_id = ufpl.user_id AND ufpl.setting_name = ‘familyName’ AND ufpl.locale = ‘es_ES’) --87
WHERE
1=1
AND ug.role_id = 1;

if i run this query manually on the DB i get the MAX_JOIN_SIZE error (unless i set the SQL_BIG_SELECTS option).

I think the root problem is this query (for example, i see redundant joins) because my site has still very little activity.

Is there any OJS maintainer/developer inthe forum that i can talk to about htis problem?

Thanks in advance!

PS: I can’t use the SQL_BIG_SELECTS workaround since my hosting won’t allow the modification of MySQL’s configuration, i also tried adding a “SET SQL_BIG_SELECTS=1;” to every big select query straight from the code but i always get a syntax error message.

I removed the following joins from the query:

LEFT JOIN user_settings usgs ON (usgs.user_id = u.user_id AND usgs.setting_name = ‘givenName’)
LEFT JOIN user_settings usfs ON (usfs.user_id = u.user_id AND usfs.setting_name = ‘familyName’)

And i solved the problems i had when trying to enter the “settings” area (i used to have the MAX_JOIN_ROWS exception), however i still have problems trying to enter the “users & roles” area, the wheel just keeps spinning…

my only clue is the following JS error i found in the browser’s console:

pkp.min.js?v=3.2.0.3:127 Uncaught Error: There is no handler bound to this element!
at Function.a.pkp.classes.Handler.getHandler (pkp.min.js?v=3.2.0.3:127)
at HTMLDivElement. (build.js?v=3.2.0.3:19428)
at Function.each (jquery.min.js?v=3.2.0.3:2)
at w.fn.init.each (jquery.min.js?v=3.2.0.3:2)
at Object.init (build.js?v=3.2.0.3:19426)
at access:218