diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-05-06 04:44:03 +0000 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-05-06 04:44:03 +0000 |
| commit | 8b3bd37549717576fc3e90cc50d7df3e01c2e110 (patch) | |
| tree | f59f3b6c386134b7589829b06147e02382cf35ec /classes/Article.php | |
| parent | 070585ac5e7785ccea0dc421d3c5d8e603d618a3 (diff) | |
| parent | 77e5deb9dda0e718227390993346994cf6cc1737 (diff) | |
Merge branch 'pg-optimize' into 'master'
drop some pointless queries now that we can use RETURNING for inserts
See merge request tt-rss/tt-rss!130
Diffstat (limited to 'classes/Article.php')
| -rw-r--r-- | classes/Article.php | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/classes/Article.php b/classes/Article.php index c0d77123c..e939298bc 100644 --- a/classes/Article.php +++ b/classes/Article.php @@ -124,18 +124,15 @@ class Article extends Handler_Protected { $sth = $pdo->prepare("INSERT INTO ttrss_entries (title, guid, link, updated, content, content_hash, date_entered, date_updated) VALUES - (?, ?, ?, NOW(), ?, ?, NOW(), NOW())"); + (?, ?, ?, NOW(), ?, ?, NOW(), NOW()) RETURNING id"); $sth->execute([$title, $guid, $url, $content, $content_hash]); - $sth = $pdo->prepare("SELECT id FROM ttrss_entries WHERE guid = ?"); - $sth->execute([$guid]); - if ($row = $sth->fetch()) { $ref_id = $row["id"]; $sth = $pdo->prepare("UPDATE ttrss_entries - SET tsvector_combined = to_tsvector( :ts_content) - WHERE id = :id"); + SET tsvector_combined = to_tsvector( :ts_content) + WHERE id = :id"); $params = [ ":ts_content" => mb_substr(\Soundasleep\Html2Text::convert($content), 0, 900000), ":id" => $ref_id]; |