Andrew Nesheret wrote:
And if i'm execute same statement without access to nodes table planer
chose to use index "fki_nodes"!!!
explain analyze SELECT 1 FROM ONLY "public"."sf_ipv4traffic" x WHERE
2003 OPERATOR(pg_catalog.=) "node" FOR SHARE OF x;
QUERY
PLAN
----------------------------------------------------------------------------------------------------------------------------
Index Scan using fki_nodes on sf_ipv4traffic x (cost=0.00..9.65 rows=1
width=6) (actual time=0.019..0.019 rows=0 loops=1)
Index Cond: (2003 = node)
Total runtime: 0.089 ms
(3 rows)
If you PREPARE .... then EXECUTE the same query, does it still use the
index? The only thing I can think of is that the trigger is planning the
query to work for any given value and you have a lot of rows with e.g.
node=2004.
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster