Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
erp5
Commits
aaa85090
Commit
aaa85090
authored
Feb 27, 2025
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CMFActivity: force using the more efficient index for non-groupable activity reservation.
parent
11d9c363
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
product/CMFActivity/Activity/SQLBase.py
product/CMFActivity/Activity/SQLBase.py
+16
-4
No files found.
product/CMFActivity/Activity/SQLBase.py
View file @
aaa85090
...
@@ -426,9 +426,13 @@ CREATE TABLE %s (
...
@@ -426,9 +426,13 @@ CREATE TABLE %s (
0
,
0
,
)[
1
]
)[
1
]
else
:
else
:
# MariaDB often choose processing_node_priority_date index
# but node2_priority_date is much faster if there exist
# many node < 0 non-groupable activities.
subquery
=
lambda
*
a
,
**
k
:
str2bytes
(
bytes2str
(
b"("
subquery
=
lambda
*
a
,
**
k
:
str2bytes
(
bytes2str
(
b"("
b"SELECT 3*priority{} AS effective_priority, date"
b"SELECT 3*priority{} AS effective_priority, date"
b" FROM %s"
b" FROM %s"
b" FORCE INDEX (node2_priority_date)"
b" WHERE"
b" WHERE"
b" {} AND"
b" {} AND"
b" processing_node=0 AND"
b" processing_node=0 AND"
...
@@ -781,9 +785,17 @@ CREATE TABLE %s (
...
@@ -781,9 +785,17 @@ CREATE TABLE %s (
0
,
0
,
))
))
else
:
else
:
if
group_method_id
:
force_index
=
''
else
:
# MariaDB often choose processing_node_priority_date index
# but node2_priority_date is much faster if there exist
# many node < 0 non-groupable activities.
force_index
=
b'FORCE INDEX (node2_priority_date)'
subquery
=
lambda
*
a
,
**
k
:
str2bytes
(
bytes2str
(
b"("
subquery
=
lambda
*
a
,
**
k
:
str2bytes
(
bytes2str
(
b"("
b"SELECT *, 3*priority{} AS effective_priority"
b"SELECT *, 3*priority{} AS effective_priority"
b" FROM %s"
b" FROM %s"
b" {}"
b" WHERE"
b" WHERE"
b" {} AND"
b" {} AND"
b" processing_node=0 AND"
b" processing_node=0 AND"
...
@@ -799,11 +811,11 @@ CREATE TABLE %s (
...
@@ -799,11 +811,11 @@ CREATE TABLE %s (
b" UNION ALL "
.
join
(
b" UNION ALL "
.
join
(
chain
(
chain
(
(
(
subquery
(
'-1'
,
'node = %i'
%
processing_node
),
subquery
(
'-1'
,
force_index
,
'node = %i'
%
processing_node
),
subquery
(
''
,
'node=0'
),
subquery
(
''
,
force_index
,
'node=0'
),
),
),
(
(
subquery
(
'-1'
,
'node = %i'
%
x
)
subquery
(
'-1'
,
force_index
,
'node = %i'
%
x
)
for
x
in
node_set
for
x
in
node_set
),
),
),
),
...
@@ -821,7 +833,7 @@ CREATE TABLE %s (
...
@@ -821,7 +833,7 @@ CREATE TABLE %s (
# sorted set to filter negative node values.
# sorted set to filter negative node values.
# This is why this query is only executed when the previous one
# This is why this query is only executed when the previous one
# did not find anything.
# did not find anything.
result
=
Results
(
query
(
subquery
(
'+1'
,
'node>0'
),
0
))
result
=
Results
(
query
(
subquery
(
'+1'
,
force_index
,
'node>0'
),
0
))
if
result
:
if
result
:
# Reserve messages.
# Reserve messages.
uid_list
=
[
x
.
uid
for
x
in
result
]
uid_list
=
[
x
.
uid
for
x
in
result
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment