Re: Database slowness -- my design, hardware, or both?
От | Reuven M. Lerner |
---|---|
Тема | Re: Database slowness -- my design, hardware, or both? |
Дата | |
Msg-id | 45EE57C4.1000405@lerner.co.il обсуждение исходный текст |
Ответ на | Re: Database slowness -- my design, hardware, or both? (Alvaro Herrera <alvherre@commandprompt.com>) |
Ответы |
Re: Database slowness -- my design, hardware, or both?
|
Список | pgsql-general |
Hi, Alvaro Herrera. You wrote:
Reuven
OK, I modified things to use interpolation. Here's the updated query:Don't assume -- measure. I had a query which ran orders of magnitude faster because I interpolated the constant list in the big query. The table from which the interpolated values were being extracted had about 30 rows or so.
explain UPDATE TransactionsAnd here is the query plan produced by explain:
SET previous_value = previous_value(id)
WHERE new_value IS NOT NULL
AND new_value <> ''
AND node_id IN (351, 169, 664, 240);
QUERY PLANI'm still a bit surprised by how different the query plan came out with what would seem like a minor change.
----------------------------------------------------------------------------------
Bitmap Heap Scan on transactions (cost=8842.88..98283.93 rows=407288 width=249)
Recheck Cond: (node_id = ANY ('{351,169,664,240}'::integer[]))
Filter: ((new_value IS NOT NULL) AND (new_value <> ''::text))
-> Bitmap Index Scan on node_id_idx (cost=0.00..8842.88 rows=434276 width=0)
Index Cond: (node_id = ANY ('{351,169,664,240}'::integer[]))
(5 rows)
Reuven
В списке pgsql-general по дате отправления: