Re: [GENERAL] Column order in multi column primary key

2016-08-09 Thread Kevin Grittner
On Mon, Aug 8, 2016 at 5:59 PM, Craig Boucher wrote: > Thanks Kevin for your response. I've Googled and debated natural > vs surrogate keys and I just find surrogate keys easier to work > with (maybe I'm just being lazy). It just seems that a > description or name is most often the natural key.

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread Craig Boucher
st 8, 2016 2:44 PM To: Craig Boucher Cc: Tom Lane ; David G. Johnston ; pgsql-general@postgresql.org Subject: Re: [GENERAL] Column order in multi column primary key On Mon, Aug 8, 2016 at 4:01 PM, Craig Boucher wrote: > From: Tom Lane [mailto:t...@sss.pgh.pa.us] >> I'm pret

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread Kevin Grittner
On Mon, Aug 8, 2016 at 4:01 PM, Craig Boucher wrote: > From: Tom Lane [mailto:t...@sss.pgh.pa.us] >> I'm pretty skeptical of the notion of redefining what your PK >> is on performance grounds. With this definition, you'd allow >> two entries with the same work_session_id, if they chanced to >> h

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread Craig Boucher
47 PM To: Craig Boucher Cc: 'David G. Johnston' ; pgsql-general@postgresql.org Subject: Re: [GENERAL] Column order in multi column primary key "Craig Boucher" writes: > I should have pointed out in my last response that I was wondering if the performance of the pk index on

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread Tom Lane
"Craig Boucher" writes: > I should have pointed out in my last response that I was wondering if the > performance of the pk index on work_session would be better if my primary key > was (customer_id, work_session_id) or if (work_session_id, customer_id) will > be fine. Customer_id will be rep

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread David G. Johnston
On Mon, Aug 8, 2016 at 4:35 PM, Craig Boucher wrote: > Thanks David. I’ve thought about the hierarchy you mentioned but the > hierarchy can change and I need to capture it as it was when the data was > generated. > > > > I should have pointed out in my last response that I was wondering if the >

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread Craig Boucher
...@gmail.com] Sent: Monday, August 8, 2016 12:43 PM To: Craig Boucher Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Column order in multi column primary key On Mon, Aug 8, 2016 at 3:06 PM, Craig Boucher mailto:cr...@wesvic.com> > wrote: Here is one of the tables that can have millions o

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread David G. Johnston
On Mon, Aug 8, 2016 at 3:06 PM, Craig Boucher wrote: > Here is one of the tables that can have millions of rows and foreign key > constraints to 5 other tables. > > > > CREATE TABLE public.work_session > > ( > > work_session_id integer NOT NULL DEFAULT nextval('worksession_ > worksessionid_seq'

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread Craig Boucher
cher Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Column order in multi column primary key On Mon, Aug 8, 2016 at 1:47 PM, Craig Boucher mailto:cr...@wesvic.com> > wrote: PG 9.5 I’m in the process of converting our application from Sql Server to Postgresql. I’m taking adva

Re: [GENERAL] Column order in multi column primary key

2016-08-08 Thread David G. Johnston
On Mon, Aug 8, 2016 at 1:47 PM, Craig Boucher wrote: > PG 9.5 > > > > I’m in the process of converting our application from Sql Server to > Postgresql. I’m taking advantage of this process to make some database > design changes. > > > > Our database contains data for many customers and I have a

[GENERAL] Column order in multi column primary key

2016-08-08 Thread Craig Boucher
PG 9.5 I'm in the process of converting our application from Sql Server to Postgresql. I'm taking advantage of this process to make some database design changes. Our database contains data for many customers and I have a customer_id column in every customer related table. One of the cha

Re: [GENERAL] Column order

2008-04-23 Thread Robert Treat
On Wednesday 23 April 2008 21:33, Vyacheslav Kalinin wrote: > Hello, > > It is often convenient to have columns of a table in certain order (as > shown by psql or most GUI database explorers, it also affects INSERT's > without columns specified behavior) so as to most significant columns > to > com

[GENERAL] Column order

2008-04-23 Thread Vyacheslav Kalinin
Hello, It is often convenient to have columns of a table in certain order (as shown by psql or most GUI database explorers, it also affects INSERT's without columns specified behavior) so as to most significant columns to come first, semantically close columns to be grouped etc, while the columns

Re: [GENERAL] column order

2006-05-25 Thread nuno
hi, all. thanks for the replies. yes, i meant 'columns' not 'rows'. sorry if i made you a bit confused. my explanation should've been more descriptive than that i suppose. anyway, it's good to know that postgresql guarantees the column order. i was just trying to be double-safe before i mess up w

Re: [GENERAL] column order

2006-05-24 Thread Michael Glaesemann
On May 24, 2006, at 22:36 , Florian G. Pflug wrote: Michael Glaesemann wrote: On May 24, 2006, at 11:54 , nuno wrote: does postgresql guarantee you that the columns in the result set would be ordered as specified in the query (i.e. id, firstname, lastname, dob) ? No. If you want a specific o

Re: [GENERAL] column order

2006-05-24 Thread Florian G. Pflug
Michael Glaesemann wrote: On May 24, 2006, at 11:54 , nuno wrote: does postgresql guarantee you that the columns in the result set would be ordered as specified in the query (i.e. id, firstname, lastname, dob) ? No. If you want a specific order, use the ORDER BY clause. I think the OP was t

Re: [GENERAL] column order

2006-05-24 Thread A. Kretschmer
am 24.05.2006, um 21:54:25 +0900 mailte Michael Glaesemann folgendes: > > On May 24, 2006, at 11:54 , nuno wrote: > > >does postgresql guarantee you that > >the columns in the result set would be ordered > >as specified in the query (i.e. id, firstname, lastname, dob) ? > > No. If you want a sp

Re: [GENERAL] column order

2006-05-24 Thread Michael Glaesemann
On May 24, 2006, at 11:54 , nuno wrote: does postgresql guarantee you that the columns in the result set would be ordered as specified in the query (i.e. id, firstname, lastname, dob) ? No. If you want a specific order, use the ORDER BY clause. Michael Glaesemann grzm seespotcode net ---

[GENERAL] column order

2006-05-24 Thread nuno
hi, all. i have a couple of questions regarding the order of table columns. say, you have a following query; SELECT id, firstname, lastname, dob FROM student; does postgresql guarantee you that the columns in the result set would be ordered as specified in the query (i.e. id, firstname, lastname