[SQL] many 'OR' in WHERE-condition

2007-04-19 Thread A. Kretschmer
Hello, a friend of mine has got a problem: in a SELECT with a condition 'WHERE foo IN (1,2,3,4,...)' with a large list within. The optimizer choose a rewrite to many OR's and a bitmap index scan on the index, no problem, fast. But if the list increase the planner choose an seq-scan. The amount o

Re: [SQL] slowness when subselect uses DISTINCT

2007-04-19 Thread Phillip Smith
Let's start with one, and whatever is causing it in one, is perhaps in theory, causing the rest :) Cheers, ~p -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stuart McGraw Sent: Friday, 20 April 2007 00:20 To: pgsql-sql@postgresql.org Subject: Re: [SQL] s

Re: [SQL] Doing a conditional insert/update

2007-04-19 Thread Rodrigo De León
On 4/19/07, Markus Holzer <[EMAIL PROTECTED]> wrote: Hello. I'm currently developing my first web app with Postgres and I have a question. How do I perform a conditional insert/update? To clarify: I need to insert data into a table when the primary key is not already in the table, or an update

Re: [SQL] Doing a conditional insert/update

2007-04-19 Thread Andrew Sullivan
On Thu, Apr 19, 2007 at 08:27:30PM +0200, Markus Holzer wrote: > How do I perform a conditional insert/update? The short answer is that you can't, at least not the way you want to. > already in the table, or an update if it is. I have currently solved this by > SELECTing for the primary key, then

[SQL] Doing a conditional insert/update

2007-04-19 Thread Markus Holzer
Hello. I'm currently developing my first web app with Postgres and I have a question. How do I perform a conditional insert/update? To clarify: I need to insert data into a table when the primary key is not already in the table, or an update if it is. I have currently solved this by SELECTing f

Re: [SQL] slowness when subselect uses DISTINCT

2007-04-19 Thread Stuart McGraw
Phillip Smith wrote: > May I suggest you post an EXPLAIN ANALYZE to the group for the query you're > having problems with...? I will do that but it has happened to me enough that it seems to be a general pattern, not something specific to one of my queries, so I thought some communal knowledge ma

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-04-19 Thread Andrew Sullivan
On Thu, Apr 19, 2007 at 09:08:27AM +0300, [EMAIL PROTECTED] wrote: > >In particular, XML is actually miserably bad at capturing certain > >kinds of relations between items. > > Write examples, please. > > P.S. By the way, XML is mentioned as tool for traffic (for transport). > But i agree to for