After Updating to OJS 3.4 I’ve found some queries running when the site is rebuilding it’s cache that puts the DB under heavy load they’re all very similar to one I’ve pasted below:
I found it after our client reported the site timing out, saw the DB at near 100% utilisation with multiple of the pasted queries below. It seems to be partially called by bots scraping the site.
Now that the cache is rebuilt the queries are slowing down and the site is accessible so it’s not ongoing but I would appreciate some advice as to how I can narrow down the cause of this issue.
I’ve enabled all debug options and check the error.log and access.log but can’t see much that indicates what causes it.
For reference It’s a multi-journal site with lots and lots of pages so that may well be a factor in the cause of this issue.
Thanks in advance for any help you can provide!
select
s
.* fromsubmissions
ass
left joinpublications
aspo
ons
.current_publication_id
=po
.publication_id
wheres
.context_id
in (47) ands
.status
in (3) and (exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘language’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘language’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘language’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘dominance’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘dominance’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘dominance’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘acculturation’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘acculturation’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘acculturation’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘shift’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘shift’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘shift’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘development’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘development’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘development’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘lifespan’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘lifespan’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘lifespan’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘complementarity’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘complementarity’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘complementarity’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘principle’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘principle’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘principle’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘polish-english’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘polish-english’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘polish-english’), ‘%’)) or exists (select * fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onsso
.object_id
=ssok
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
wheresskl
.keyword_text
= LOWER(‘bilinguals’) ands
.submission_id
=sso
.submission_id
) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinpublication_settings
asps
onp
.publication_id
=ps
.publication_id
whereps
.setting_name
= ‘title’ and LOWER(ps.setting_value) LIKE CONCAT(‘%’, LOWER(‘bilinguals’), ‘%’)) ors
.submission_id
in (selectp
.submission_id
frompublications
asp
inner joinauthors
asau
onau
.publication_id
=p
.publication_id
inner joinauthor_settings
asaus
onaus
.author_id
=au
.author_id
whereaus
.setting_name
in (‘givenName’, ‘familyName’, ‘orcid’) and LOWER(aus.setting_value) LIKE CONCAT(‘%’, LOWER(‘bilinguals’), ‘%’))) ands
.submission_id
not in (19200) order by (select COUNT(DISTINCT sskl.keyword_id) fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onssok
.object_id
=sso
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘language’) orsskl
.keyword_text
= LOWER(‘dominance’) orsskl
.keyword_text
= LOWER(‘acculturation’) orsskl
.keyword_text
= LOWER(‘shift’) orsskl
.keyword_text
= LOWER(‘development’) orsskl
.keyword_text
= LOWER(‘lifespan’) orsskl
.keyword_text
= LOWER(‘complementarity’) orsskl
.keyword_text
= LOWER(‘principle’) orsskl
.keyword_text
= LOWER(‘polish-english’) orsskl
.keyword_text
= LOWER(‘bilinguals’)) ands
.submission_id
=sso
.submission_id
) desc, (select COUNT(0) fromsubmission_search_objects
assso
inner joinsubmission_search_object_keywords
asssok
onssok
.object_id
=sso
.object_id
inner joinsubmission_search_keyword_list
assskl
onsskl
.keyword_id
=ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘language’) orsskl
.keyword_text
= LOWER(‘dominance’) orsskl
.keyword_text
= LOWER(‘acculturation’) orsskl
.keyword_text
= LOWER(‘shift’) orsskl
.keyword_text
= LOWER(‘development’) orsskl
.keyword_text
= LOWER(‘lifespan’) orsskl
.keyword_text
= LOWER(‘complementarity’) orsskl
.keyword_text
= LOWER(‘principle’) orsskl
.keyword_text
= LOWER(‘polish-english’) orsskl
.keyword_text
= LOWER(‘bilinguals’)) ands
.submission_id
=sso
.submission_id
) desc limit 10 offset 0