Re: foreign key constraint, planner ignore index.

From: Richard Huxton <dev(at)archonet(dot)com>
To: Andrew Nesheret <andrew(at)infinet(dot)ru>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: foreign key constraint, planner ignore index.
Date: 2007-12-19 13:26:11
Message-ID: 47691BF3.4030502@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2007-12-19 13:40:51 Re: Trouble running PostgreSQL server / Server must be started under certain locale.
Previous Message Geoff Ellingwood 2007-12-19 12:57:43 Trouble running PostgreSQL server / Server must be started under certain locale.