Our portal includes more than 50 journals and more than 9000 submissions. We successfully migrated from OJS 2.4.8-5 to OJS 3.2.1-5 and then to OJS 3.3.0-18.
We faced considerable slowness after some days of using that version. Our database was consuming a lot of resources, running dozens of queries simultaneously and reading thousands of rows, impacting the client experience dramatically. I contacted the host, who shared a log of the slow queries (attached). We set the “scheduled_tasks = Off” and disabled the “Acron Plugin” and “PKP PN Plugin” for all the journals so as not to let them run background tasks that were degrading the performance. The performance is excellent; we are manually depositing the DOIs in the CrossRef, but my concern is whether this action would impact the indexing or any other recommended task to be run.
We will test the migration to OJS.3.4 soon, but before going any further (as not all plugins are working in OJS 3.4), we would like your recommendation about the scheduled tasks on OJS 3.3.0-18. Is there any workaround that would avoid the considerable usage of the database resources? Can it be done as a one-by-one task instead of doing a lot simultaneously?:
PHP Version 7.4.11
Database Table Engine: InnoDB
OS: CentOS 7 - 64 bits
Server/Hosting Specifications:
CPU: 2 vCPU
RAM:8GB
Disk Space: Total of 140 GB (78 GB available)
Server Logs:
Time: 2024-09-06T17:15:13.171093Z
User@Host: database_name[database_name] @ [186.202.13.208] Id: 574856
Schema: database_name Last_errno: 0 Killed: 0
Query_time: 12.636103 Lock_time: 0.000453 Rows_sent: 1 Rows_examined: 605140 Rows_affected: 0
Bytes_sent: 72
SET timestamp=1725642913;
SELECT COUNT() AS row_count FROM (select s
. from submissions
as s
where s
.context_id
= 53 and s
.status
in (3) and (exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘inmunidad’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘jurisdicción’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘acceso’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘justicia’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘derecho’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘procesal’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘civil’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘internacional’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘convención’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘las’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘naciones’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘unidas’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘sobre’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘inmunidades’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘estados’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘sus’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘bienes’) and s
.submission_id
= sso
.submission_id
)) and s
.submission_id
<> 4462 group by s
.submission_id
order by (select COUNT(0) from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on ssok
.object_id
= sso
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘inmunidad’) or sskl
.keyword_text
= LOWER(‘jurisdicción’) or sskl
.keyword_text
= LOWER(‘acceso’) or sskl
.keyword_text
= LOWER(‘justicia’) or sskl
.keyword_text
= LOWER(‘derecho’) or sskl
.keyword_text
= LOWER(‘procesal’) or sskl
.keyword_text
= LOWER(‘civil’) or sskl
.keyword_text
= LOWER(‘internacional’) or sskl
.keyword_text
= LOWER(‘convención’) or sskl
.keyword_text
= LOWER(‘las’) or sskl
.keyword_text
= LOWER(‘naciones’) or sskl
.keyword_text
= LOWER(‘unidas’) or sskl
.keyword_text
= LOWER(‘sobre’) or sskl
.keyword_text
= LOWER(‘inmunidades’) or sskl
.keyword_text
= LOWER(‘estados’) or sskl
.keyword_text
= LOWER(‘sus’) or sskl
.keyword_text
= LOWER(‘bienes’)) and s
.submission_id
= sso
.submission_id
) desc, (select COUNT(DISTINCT sskl.keyword_id) from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on ssok
.object_id
= sso
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘inmunidad’) or sskl
.keyword_text
= LOWER(‘jurisdicción’) or sskl
.keyword_text
= LOWER(‘acceso’) or sskl
.keyword_text
= LOWER(‘justicia’) or sskl
.keyword_text
= LOWER(‘derecho’) or sskl
.keyword_text
= LOWER(‘procesal’) or sskl
.keyword_text
= LOWER(‘civil’) or sskl
.keyword_text
= LOWER(‘internacional’) or sskl
.keyword_text
= LOWER(‘convención’) or sskl
.keyword_text
= LOWER(‘las’) or sskl
.keyword_text
= LOWER(‘naciones’) or sskl
.keyword_text
= LOWER(‘unidas’) or sskl
.keyword_text
= LOWER(‘sobre’) or sskl
.keyword_text
= LOWER(‘inmunidades’) or sskl
.keyword_text
= LOWER(‘estados’) or sskl
.keyword_text
= LOWER(‘sus’) or sskl
.keyword_text
= LOWER(‘bienes’)) and s
.submission_id
= sso
.submission_id
) desc) AS count_subquery;
Time: 2024-09-06T17:15:13.585418Z
User@Host: database_name[database_name] @ [186.202.13.208] Id: 574839
Schema: database_name Last_errno: 0 Killed: 0
Query_time: 12.575346 Lock_time: 0.000583 Rows_sent: 10 Rows_examined: 604526 Rows_affected: 0
Bytes_sent: 1558
SET timestamp=1725642913;
select s
.* from submissions
as s
where s
.context_id
= 53 and s
.status
in (3) and (exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘inmunidad’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘jurisdicción’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘acceso’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘justicia’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘derecho’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘procesal’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘civil’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘internacional’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘convención’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘las’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘naciones’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘unidas’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘sobre’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘inmunidades’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘estados’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘sus’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘bienes’) and s
.submission_id
= sso
.submission_id
)) and s
.submission_id
<> 4462 group by s
.submission_id
order by (select COUNT(0) from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on ssok
.object_id
= sso
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘inmunidad’) or sskl
.keyword_text
= LOWER(‘jurisdicción’) or sskl
.keyword_text
= LOWER(‘acceso’) or sskl
.keyword_text
= LOWER(‘justicia’) or sskl
.keyword_text
= LOWER(‘derecho’) or sskl
.keyword_text
= LOWER(‘procesal’) or sskl
.keyword_text
= LOWER(‘civil’) or sskl
.keyword_text
= LOWER(‘internacional’) or sskl
.keyword_text
= LOWER(‘convención’) or sskl
.keyword_text
= LOWER(‘las’) or sskl
.keyword_text
= LOWER(‘naciones’) or sskl
.keyword_text
= LOWER(‘unidas’) or sskl
.keyword_text
= LOWER(‘sobre’) or sskl
.keyword_text
= LOWER(‘inmunidades’) or sskl
.keyword_text
= LOWER(‘estados’) or sskl
.keyword_text
= LOWER(‘sus’) or sskl
.keyword_text
= LOWER(‘bienes’)) and s
.submission_id
= sso
.submission_id
) desc, (select COUNT(DISTINCT sskl.keyword_id) from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on ssok
.object_id
= sso
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘inmunidad’) or sskl
.keyword_text
= LOWER(‘jurisdicción’) or sskl
.keyword_text
= LOWER(‘acceso’) or sskl
.keyword_text
= LOWER(‘justicia’) or sskl
.keyword_text
= LOWER(‘derecho’) or sskl
.keyword_text
= LOWER(‘procesal’) or sskl
.keyword_text
= LOWER(‘civil’) or sskl
.keyword_text
= LOWER(‘internacional’) or sskl
.keyword_text
= LOWER(‘convención’) or sskl
.keyword_text
= LOWER(‘las’) or sskl
.keyword_text
= LOWER(‘naciones’) or sskl
.keyword_text
= LOWER(‘unidas’) or sskl
.keyword_text
= LOWER(‘sobre’) or sskl
.keyword_text
= LOWER(‘inmunidades’) or sskl
.keyword_text
= LOWER(‘estados’) or sskl
.keyword_text
= LOWER(‘sus’) or sskl
.keyword_text
= LOWER(‘bienes’)) and s
.submission_id
= sso
.submission_id
) desc LIMIT 10 OFFSET 520;
Time: 2024-09-06T17:15:14.191076Z
User@Host: database_name[database_name] @ [186.202.13.208] Id: 574852
Schema: database_name Last_errno: 0 Killed: 0
Query_time: 12.553281 Lock_time: 0.000634 Rows_sent: 1 Rows_examined: 605140 Rows_affected: 0
Bytes_sent: 72
SET timestamp=1725642914;
SELECT COUNT() AS row_count FROM (select s
. from submissions
as s
where s
.context_id
= 53 and s
.status
in (3) and (exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘inmunidad’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘jurisdicción’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘acceso’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘justicia’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘derecho’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘procesal’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘civil’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘internacional’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘convención’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘las’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘naciones’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘unidas’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘sobre’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘inmunidades’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘estados’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘sus’) and s
.submission_id
= sso
.submission_id
) or exists (select * from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on sso
.object_id
= ssok
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where sskl
.keyword_text
= LOWER(‘bienes’) and s
.submission_id
= sso
.submission_id
)) and s
.submission_id
<> 4462 group by s
.submission_id
order by (select COUNT(0) from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on ssok
.object_id
= sso
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘inmunidad’) or sskl
.keyword_text
= LOWER(‘jurisdicción’) or sskl
.keyword_text
= LOWER(‘acceso’) or sskl
.keyword_text
= LOWER(‘justicia’) or sskl
.keyword_text
= LOWER(‘derecho’) or sskl
.keyword_text
= LOWER(‘procesal’) or sskl
.keyword_text
= LOWER(‘civil’) or sskl
.keyword_text
= LOWER(‘internacional’) or sskl
.keyword_text
= LOWER(‘convención’) or sskl
.keyword_text
= LOWER(‘las’) or sskl
.keyword_text
= LOWER(‘naciones’) or sskl
.keyword_text
= LOWER(‘unidas’) or sskl
.keyword_text
= LOWER(‘sobre’) or sskl
.keyword_text
= LOWER(‘inmunidades’) or sskl
.keyword_text
= LOWER(‘estados’) or sskl
.keyword_text
= LOWER(‘sus’) or sskl
.keyword_text
= LOWER(‘bienes’)) and s
.submission_id
= sso
.submission_id
) desc, (select COUNT(DISTINCT sskl.keyword_id) from submission_search_objects
as sso
inner join submission_search_object_keywords
as ssok
on ssok
.object_id
= sso
.object_id
inner join submission_search_keyword_list
as sskl
on sskl
.keyword_id
= ssok
.keyword_id
where (sskl
.keyword_text
= LOWER(‘inmunidad’) or sskl
.keyword_text
= LOWER(‘jurisdicción’) or sskl
.keyword_text
= LOWER(‘acceso’) or sskl
.keyword_text
= LOWER(‘justicia’) or sskl
.keyword_text
= LOWER(‘derecho’) or sskl
.keyword_text
= LOWER(‘procesal’) or sskl
.keyword_text
= LOWER(‘civil’) or sskl
.keyword_text
= LOWER(‘internacional’) or sskl
.keyword_text
= LOWER(‘convención’) or sskl
.keyword_text
= LOWER(‘las’) or sskl
.keyword_text
= LOWER(‘naciones’) or sskl
.keyword_text
= LOWER(‘unidas’) or sskl
.keyword_text
= LOWER(‘sobre’) or sskl
.keyword_text
= LOWER(‘inmunidades’) or sskl
.keyword_text
= LOWER(‘estados’) or sskl
.keyword_text
= LOWER(‘sus’) or sskl
.keyword_text
= LOWER(‘bienes’)) and s
.submission_id
= sso
.submission_id
) desc) AS count_subquery;
Thanks,
Sergio