有沒有辦法加快這件事? SELECT LOWER(nameid), COUNT(nameid) AS cant
FROM infos AS i
WHERE i.value > 0
AND i.oid IN ($1)
AND i.nameid IN ($2)
GROUP BY nameid
$ 1 是一個長期的逗號分隔列表一樣的ID 1,2,3,4,5,6,7等。 $ 2 就好比是 「
explain analyze表明Postgres將使用索引掃描我的查詢,其獲取的行和由日期執行濾波(即,2017-04-14 05:27:51.039): explain analyze select * from tbl t where updated > '2017-04-14 05:27:51.039';
QUERY PLAN
我在AWS中有一個生產數據庫,但localhost中的相同數據庫要快得多(25s VS 7s),做了一些研究,我發現在同一個SQL中有一個差異: EXPLAIN extended
SELECT *
FROM pipeline p
JOIN invoice i ON p.invoice_id = i.id
WHERE i.whenCreated BETWEEN "2017-01-01 00: