Re: [SQL] Very large IN-clause is slow, but how to rewrite it?

2007-02-25 Thread Richard Jones
On Sun, Feb 25, 2007 at 01:34:44PM -0500, Tom Lane wrote: > Joe Conway <[EMAIL PROTECTED]> writes: > > If 8.2, what about > >... WHERE foo IN (select x from (values (1$),(2$),...,(N$)) as t(x)) > > ? > > Well, the OP wasn't using 8.2 --- judging from the selected plan, it had > to be 8.0 or ol

[SQL] Very large IN-clause is slow, but how to rewrite it?

2007-02-25 Thread Richard Jones
I've been profiling a PG database / mix of applications and found that one statement which takes a very long time to execute is: select e.keywordid, e.quantity, e.max_cpc, i.position from bid3_events_impressions i, bid3_events e where i.eventid = e.id and e.keywordid in ($1,$2,$3,

Re: [SQL] Referential integrity (foreign keys) across multiple tables

2006-07-24 Thread Richard Jones
On Mon, Jul 24, 2006 at 12:26:15PM -0500, Aaron Bono wrote: > On 7/22/06, Richard Jones <[EMAIL PROTECTED]> wrote: > > create table hosts ( > >id serial primary key, > >hostname text not null > > ); > > > > create table pages ( > >

Re: [SQL] Referential integrity (foreign keys) across multiple tables

2006-07-24 Thread Richard Jones
On Mon, Jul 24, 2006 at 12:51:48PM -0500, Bruno Wolff III wrote: > On Mon, Jul 24, 2006 at 09:59:07 +0100, > Richard Jones <[EMAIL PROTECTED]> wrote: > > On Sun, Jul 23, 2006 at 01:32:37PM -0500, Bruno Wolff III wrote: > > > On Sat, Jul 22, 2006 at 14:32:57 +0100, &g

Re: [SQL] Referential integrity (foreign keys) across multiple tables

2006-07-24 Thread Richard Jones
On Sun, Jul 23, 2006 at 01:32:37PM -0500, Bruno Wolff III wrote: > On Sat, Jul 22, 2006 at 14:32:57 +0100, > Richard Jones <[EMAIL PROTECTED]> wrote: > > > > Now I want to add a column to page_contents, say called link_name, > > which is going to referenc

[SQL] Referential integrity (foreign keys) across multiple tables

2006-07-22 Thread Richard Jones
ggers, and if so is that as robust as referential integrity? Rich. -- Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Team Notepad - intranets and extranets for business - http://team-notepad.com ---(end of

Re: [SQL] NOT and AND problem

2003-07-17 Thread Richard Jones
WHERE workspace_item_id = eulepersongroup2workspaceitem.workspace_item_id ) OR NOT EXISTS ( SELECT 1 FROM epersongroup WHERE eperson_group_id = eulepersongroup2workspaceitem.eperson_group_id ); Thanks very much for your help. Regards Richard Richard Jones --- Systems Deve

[SQL] NOT and AND problem

2003-07-17 Thread Richard Jones
Can anyone help me understand what is going on? Any suggestions gratefully received. Cheers Richard Richard Jones --- Systems Developer Theses Alive! - www.thesesalive.ac.uk Edinburgh University Library [EMAIL PROTECTED] 0131 651 1611