RE: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Stephan Szabo
On Fri, 9 Mar 2001, Creager, Robert S wrote: > > Well, that explains why I wasn't seeing any appreciable speed increase with > the INITIALLY DEFERRED. I tried mucking in pg_class, and saw a 3 fold > increase in insert speed on inserts into my table with 2 relational > triggers. SET CONSTRAINTS

RE: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Creager, Robert S
Well, that explains why I wasn't seeing any appreciable speed increase with the INITIALLY DEFERRED. I tried mucking in pg_class, and saw a 3 fold increase in insert speed on inserts into my table with 2 relational triggers. SET CONSTRAINTS ALL DEFERRED does nothing to very little to increase th

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Stephan Szabo
On Fri, 9 Mar 2001, Josh Berkus wrote: > Robert, > > > I suspect that the INSERT INTO SELECT in this case will take longer than a > > CREATE TABLE AS because of the referential integrity check needed on every > > INSERT (per Tom Lane). > > In that case, what about: > > a) dropping the referent

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Josh Berkus
Robert, > I suspect that the INSERT INTO SELECT in this case will take longer than a > CREATE TABLE AS because of the referential integrity check needed on every > INSERT (per Tom Lane). In that case, what about: a) dropping the referential integrity check; 2) making the referential integrity c

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Peter Eisentraut
Creager, Robert S writes: > psql -d tassiv -c "\ > create table observationsII ( \ > ra float8 not null, \ > decl float8 not null, \ > mag float8 not null, \ > smag float8 not null, \ > obs_id serial, \ > file_id int4 references files on delete cascade, \ > star_id int4 references comp_loc on del

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Josh Berkus
Robert, > How then can I add in a DEFAULT nextval in place of SERIAL and get > the > REFERENCES in there? Or can I? You can't (as far as I know). If that's important to you, you need to create the table first with a regular CREATE TABLE statement, then do INSERT INTO. CREATE TABLE AS is, I b

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Tom Lane
"Creager, Robert S" <[EMAIL PROTECTED]> writes: > And the next question, should this really be taking 3 hours to insert 315446 > records? I noticed the disk is basically idle during the few times when I > watched. Would this be because of the index created on obs_id? Not for a single index. I

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Josh Berkus
Robert, > Thanks for the pointers. I'm actually working on modifying the structure of > an existing db, so this is all within Pg. Those INSERT INTOs with SELECTs > are painfully slow, and I have an larger table to do this to... I guess > Perl will have to rescue me... Why don't you post your

Re: [SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Josh Berkus
Robert, I can't help you with your performance problem, but I can help you with CREATE TABLE AS. You've mistaken the syntax; CREATE TABLE AS does not use column definitions other than the query. Thus, the correct syntax should be: > create table observationsII > AS select o.ra, o.decl

[SQL] cannot get CREATE TABLE AS to work

2001-03-09 Thread Creager, Robert S
I'm sure I'm doing something wrong, and I'm hoping someone can show me the way of things. Running 7.1beta5 on an Ultra 5, Solaris 2.6 w/256Mb mem. If I remove the AS, the table creates correctly and I can do the INSERT INTO with the SELECT clause psql -d tassiv -c "\ create table observationsI