Re: [GENERAL] About index - "a query or data manipulation command

2005-04-26 Thread Ragnar =?ISO-8859-1?Q?Hafsta=F0?=
On Tue, 2005-04-26 at 13:58 -0400, Ying Lu wrote:

> select * from A left join B using (id) where A.type='apple' and 
> A.isExport=true;
> 
> "id" is the primary key for both table A & B. If index (type, isExport) 
> has been created for table A. In the above query, will this index works?

simplest is just to do an explain.

explain select * from A left join B using (id) where A.type='apple' and
  A.isExport=true;

gnari




---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [GENERAL] SQLException "Connection is closed. Operation is not

2005-04-25 Thread Ragnar =?ISO-8859-1?Q?Hafsta=F0?=
On Mon, 2005-04-25 at 03:38 +0530, Rajiv Verma wrote:
> I'm accessing postgres database through tomcat 4.3.1.
> I'm able to execute the select and update query through my application
> but Insert query is giving following SQLException :
> Connection is closed.  Operation is not permitted.

looks like your application is closing the database
connection before the insert.

are you doing the insert within the same tomcat
request as the selects ?

con you reproduce this using the simplest possible
test case. i.e:
have your doPost() only 
  a) open db connection
  b) perform select
  c) perform insert
  d) close db connection
  e) return ok page

gnari



---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [GENERAL] Primary Key and Indices

2005-04-24 Thread Ragnar =?ISO-8859-1?Q?Hafsta=F0?=
On Sun, 2005-04-24 at 09:49 -0700, Rich Shepard wrote:
>I'm converting mysql tables to postgres. One of the tables has this:
> 
>PRIMARY KEY (org_id, contact_id),
>KEY contact (contact_id, org_id)
> 
>Is there really a difference in the two indices if the sequence of fields
> is reversed?

yes.
for example, only the first one can be used for ORDER BY org_id

gnari



---(end of broadcast)---
TIP 8: explain analyze is your friend