Re: [SQL] changing multiple pk's in one update

2009-04-15 Thread Jasen Betts
On 2009-04-13, Stuart McGraw wrote: > Jasen Betts wrote: >> I see no reason to keep the index (and its associated UNIQUE >> constraint) during the update, AFAICT all it does is slow the process >> down. > > Thanks for the suggestion. > > Unfortunately I am doing this key renumbering in > an inter

Re: [SQL] ENUM vs DOMAIN vs FKyed loookup table

2009-04-15 Thread Jasen Betts
On 2009-04-12, Dirk Jagdmann wrote: >> When you need to choose between enum types, domain types or lookup tables >> with foreign keys, what do you usualy choose? > > When I have a column with valid values that I know when writing my > tables and that will *never* change I use an enum. For example

Re: [SQL] Postgres process resident size does not drop after killing statement

2009-04-15 Thread Tom Lane
Bryce Nesbitt writes: > Every so often our production Postgres 8.3 system will get statement > that runs for a few hours, or a few days, or more, and needs to be > killed dead. We kill it with pg_cancel_backend(), and cpu usage of the > process immediately drops, and the process starts serving ot

Re: [SQL] ENUM vs DOMAIN vs FKyed loookup table

2009-04-15 Thread Chris Browne
ja...@xnet.co.nz (Jasen Betts) writes: > On 2009-04-12, Dirk Jagdmann wrote: >>> When you need to choose between enum types, domain types or lookup >>> tables with foreign keys, what do you usualy choose? >> >> When I have a column with valid values that I know when writing my >> tables and that w

[SQL] How to count from a second table in an aggregate query?

2009-04-15 Thread Steve Midgley
Hi, I'm trying to figure out how to do something which I'd guess is easy for a sql whiz but has me stumped. I would greatly appreciate any help on this - it's a form of SQL query that I've never figured out, but have wanted to use many times over the years.. I want to generate an analysis re

Re: [SQL] changing multiple pk's in one update

2009-04-15 Thread Glenn Maynard
On Wed, Apr 15, 2009 at 8:43 AM, Jasen Betts wrote: > the update takes a long time too if it's updating all the rows. > and updating the index piecewise at the same time. > with the index extant I get from 20 (if the start and end ranges don't > overlap) and 28s (with , > to 28 seconds (maximum o

Re: [SQL] How to count from a second table in an aggregate query?

2009-04-15 Thread Erik Jones
On Apr 15, 2009, at 1:15 PM, Steve Midgley wrote: Hi, I'm trying to figure out how to do something which I'd guess is easy for a sql whiz but has me stumped. I would greatly appreciate any help on this - it's a form of SQL query that I've never figured out, but have wanted to use many ti

Re: [SQL] How to count from a second table in an aggregate query?

2009-04-15 Thread Steve Midgley
Erik Jones wrote: On Apr 15, 2009, at 1:15 PM, Steve Midgley wrote: I want to generate an analysis report that counts the values in two separate tables. I've been able to accomplish what I want with two separate queries that I then merge together in Excel. Essentially what I need is a "horiz