Re: foreign key constraint, planner ignore index. - Mailing list pgsql-general

From Richard Huxton
Subject Re: foreign key constraint, planner ignore index.
Date
Msg-id 47691BF3.4030502@archonet.com
Whole thread Raw
In response to Re: foreign key constraint, planner ignore index.  (Andrew Nesheret <andrew@infinet.ru>)
Responses Re: foreign key constraint, planner ignore index.  (Andrew Nesheret <andrew@infinet.ru>)
List pgsql-general
Andrew Nesheret wrote:
> Richard Huxton wrote:
>> If you PREPARE .... then EXECUTE the same query, does it still use the
>> index?
> Done, same result.
> --- Code ---
>      stmt = connection.prepareStatement( "explain analyze SELECT 1 FROM
> ONLY sf_ipv4traffic x WHERE ? OPERATOR(pg_catalog.=) node FOR SHARE OF
> x" );
>      stmt.setLong( 1, 2004 );
>      rs = stmt.executeQuery();
>      while(rs.next())
>      {
>        System.out.println( rs.getString(1) );
>      }

No, this will produce different plans - what happens if you supply each
parameter in turn - the second plan should stay the same as the first.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Geoff Ellingwood"
Date:
Subject: Trouble running PostgreSQL server / Server must be started under certain locale.
Next
From: Richard Huxton
Date:
Subject: Re: Trouble running PostgreSQL server / Server must be started under certain locale.