Performance: selector2sql for operator "contains one" of tags generates heavy CPU load on database server.
This commit is contained in:
parent
5bfe289811
commit
355b6d5f84
1 changed files with 8 additions and 14 deletions
|
@ -723,20 +723,14 @@ condition example
|
||||||
bind_params.push selector['value'].count
|
bind_params.push selector['value'].count
|
||||||
bind_params.push selector['value']
|
bind_params.push selector['value']
|
||||||
elsif selector['operator'] == 'contains one' && attributes[0] == 'ticket' && attributes[1] == 'tags'
|
elsif selector['operator'] == 'contains one' && attributes[0] == 'ticket' && attributes[1] == 'tags'
|
||||||
query += "1 <= (
|
tables += ', tag_objects, tag_items, tags'
|
||||||
SELECT
|
query += "
|
||||||
COUNT(*)
|
|
||||||
FROM
|
|
||||||
tag_objects,
|
|
||||||
tag_items,
|
|
||||||
tags
|
|
||||||
WHERE
|
|
||||||
tickets.id = tags.o_id AND
|
tickets.id = tags.o_id AND
|
||||||
tag_objects.id = tags.tag_object_id AND
|
tag_objects.id = tags.tag_object_id AND
|
||||||
tag_objects.name = 'Ticket' AND
|
tag_objects.name = 'Ticket' AND
|
||||||
tag_items.id = tags.tag_item_id AND
|
tag_items.id = tags.tag_item_id AND
|
||||||
tag_items.name IN (?)
|
tag_items.name IN (?)"
|
||||||
)"
|
|
||||||
bind_params.push selector['value']
|
bind_params.push selector['value']
|
||||||
elsif selector['operator'] == 'contains all not' && attributes[0] == 'ticket' && attributes[1] == 'tags'
|
elsif selector['operator'] == 'contains all not' && attributes[0] == 'ticket' && attributes[1] == 'tags'
|
||||||
query += "0 = (
|
query += "0 = (
|
||||||
|
|
Loading…
Reference in a new issue