Skip to content
Snippets Groups Projects
Verified Commit 2d507bb6 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Minor change to hopefully improve the performance

parent b8c7e12e
No related branches found
No related tags found
No related merge requests found
...@@ -64,6 +64,9 @@ class PostgresSmartBackend implements Backend ...@@ -64,6 +64,9 @@ class PostgresSmartBackend implements Backend
$tsQueryFunction = $this->tsQueryFunction(); $tsQueryFunction = $this->tsQueryFunction();
$rankingFunction = $this->rankingFunction(); $rankingFunction = $this->rankingFunction();
return $this->db->prepare(" return $this->db->prepare("
WITH matching_backlog AS (
SELECT * FROM backlog WHERE tsv @@ $tsQueryFunction
)
SELECT SELECT
ranked_messages.bufferid, ranked_messages.bufferid,
ranked_messages.buffername, ranked_messages.buffername,
...@@ -101,7 +104,7 @@ class PostgresSmartBackend implements Backend ...@@ -101,7 +104,7 @@ class PostgresSmartBackend implements Backend
query, query,
$rankingFunction AS rank_value $rankingFunction AS rank_value
FROM FROM
backlog matching_backlog AS backlog
JOIN buffer ON backlog.bufferid = buffer.bufferid JOIN buffer ON backlog.bufferid = buffer.bufferid
, $tsQueryFunction query , $tsQueryFunction query
WHERE buffer.userid = :userid WHERE buffer.userid = :userid
...@@ -150,6 +153,9 @@ class PostgresSmartBackend implements Backend ...@@ -150,6 +153,9 @@ class PostgresSmartBackend implements Backend
$tsQueryFunction = $this->tsQueryFunction(); $tsQueryFunction = $this->tsQueryFunction();
$rankingFunction = $this->rankingFunction(); $rankingFunction = $this->rankingFunction();
return $this->db->prepare(" return $this->db->prepare("
WITH matching_backlog AS (
SELECT * FROM backlog WHERE tsv @@ $tsQueryFunction
)
SELECT SELECT
matching_messages.messageid, matching_messages.messageid,
matching_messages.time, matching_messages.time,
...@@ -168,7 +174,7 @@ class PostgresSmartBackend implements Backend ...@@ -168,7 +174,7 @@ class PostgresSmartBackend implements Backend
query, query,
$rankingFunction AS rank_value $rankingFunction AS rank_value
FROM FROM
backlog matching_backlog AS backlog
JOIN buffer ON backlog.bufferid = buffer.bufferid JOIN buffer ON backlog.bufferid = buffer.bufferid
, $tsQueryFunction query , $tsQueryFunction query
WHERE buffer.userid = :userid WHERE buffer.userid = :userid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment