SELECT subj_id, max(timestamp) AS timestamp
FROM event_view
WHERE (((subj_uri = 'application://gedit.desktop')
OR (subj_uri = 'application://devhelp.desktop')
OR (subj_uri = 'application://google-chrome.desktop') OR ...
GROUP BY subj_id;
executes in 20seconds here.
On the other hand:
SELECT subj_id, max(timestamp) FROM event_view WHERE subj_id IN
(SELECT id
FROM uri
WHERE (((value = 'application://gedit.desktop')
OR (value = 'application://devhelp.desktop')
OR (value = 'application://google-chrome.desktop') OR ...)
GROUP BY subj_id;
executes immediately. Of course results are equivalent.
And concluding:
SELECT subj_id, max(timestamp) AS timestamp //gedit. desktop' ) //devhelp. desktop' ) //google- chrome. desktop' ) OR ...
FROM event_view
WHERE (((subj_uri = 'application:
OR (subj_uri = 'application:
OR (subj_uri = 'application:
GROUP BY subj_id;
executes in 20seconds here.
On the other hand: //gedit. desktop' ) //devhelp. desktop' ) //google- chrome. desktop' ) OR ...)
SELECT subj_id, max(timestamp) FROM event_view WHERE subj_id IN
(SELECT id
FROM uri
WHERE (((value = 'application:
OR (value = 'application:
OR (value = 'application:
GROUP BY subj_id;
executes immediately. Of course results are equivalent.