Re: [SQL] alter table

2006-02-15 Thread Michael Glaesemann
On Feb 16, 2006, at 3:11 , Maciej Piekielniak wrote: How can i modify few fields with alter? I think you need to alter columns one at a time. If you need them to go into effect at the same time, you can wrap the multiple ALTER TABLE statements in a transaction. For example, begin; ALTER

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Daniel Caune
> "Owen Jacobson" <[EMAIL PROTECTED]> writes: > > On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote: > >> I see, but that doesn't explain whether it is possible to specify the > >> index to use. It seems that those options just force PostgreSQL using > >> another plan. > > > Drop the

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Tom Lane
"Owen Jacobson" <[EMAIL PROTECTED]> writes: > On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote: >> I see, but that doesn't explain whether it is possible to specify the >> index to use. It seems that those options just force PostgreSQL using >> another plan. > Drop the simple index an

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Daniel Caune
> > > > Is there a way to force PostgreSQL using an index for a SELECT > > > > statement? > > > > > > Your best bet is to do > > > > > > set enable_indexscan=false; > > > > > > and then do the EXPLAIN ANALYSE for your select. > > > > I see, but that doesn't explain whether it is possible to speci

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Tom Lane
"Daniel Caune" <[EMAIL PROTECTED]> writes: > SELECT > FROM GSLOG_EVENT > WHERE EVENT_NAME = 'player-status-update' > AND EVENT_DATE_CREATED >= > AND EVENT_DATE_CREATED < > I have an index on EVENT_DATE_CREATED that does it job. But I though > that I can help my favourite PostgreSQL

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Andrew Sullivan
On Wed, Feb 15, 2006 at 05:26:57PM -0500, Daniel Caune wrote: > I have an index on EVENT_DATE_CREATED that does it job. But I though > that I can help my favourite PostgreSQL if I create a composite index on > EVENT_DATE_CREATED and EVENT_NAME (in that order as EVENT_DATE_CREATED > is more dense t

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Owen Jacobson
Daniel Caune wrote: > > Andrew Sullivan wrote: > > > On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote: > > > > > > > > Is there a way to force PostgreSQL using an index for a SELECT > > > statement? > > > > Your best bet is to do > > > > set enable_indexscan=false; > > > > and then

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Daniel Caune
> On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote: > > Hi, > > > > > > > > Is there a way to force PostgreSQL using an index for a SELECT > > statement? I just want to confirm that the index PostgreSQL decides to > > use is better than the index I supposed PostgreSQL would use (I alr

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Owen Jacobson
SET SESSION enable_seqscan TO OFF could be interpreted as a strong hint to the server that you want it to use indexes. It's not completely mandatory (the server WILL still do a sequential scan if it has to) but postgresql will strongly prefer index scans. You may also have some luck twiddling

Re: [SQL] How to force PostgreSQL using an index

2006-02-15 Thread Andrew Sullivan
On Wed, Feb 15, 2006 at 04:58:54PM -0500, Daniel Caune wrote: > Hi, > > > > Is there a way to force PostgreSQL using an index for a SELECT > statement? I just want to confirm that the index PostgreSQL decides to > use is better than the index I supposed PostgreSQL would use (I already > analyz

[SQL] How to force PostgreSQL using an index

2006-02-15 Thread Daniel Caune
Hi,   Is there a way to force PostgreSQL using an index for a SELECT statement?  I just want to confirm that the index PostgreSQL decides to use is better than the index I supposed PostgreSQL would use (I already analyze the table).   Regards,   -- Daniel CAUNE Ubisoft Online Techno

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Stephan, Wednesday, February 15, 2006, 9:03:26 PM, you wrote: SS> Not in 7.4, but I believe 8.1 allows that (ALTER TABLE ALTER COLUMN TYPE SS> with semi-optional USING) Thx for all. -- Best regards, Maciejmailto:[EMAIL PROTECTED] ---

Re: [SQL] alter table

2006-02-15 Thread Stephan Szabo
On Wed, 15 Feb 2006, Owen Jacobson wrote: > Maciej Piekielniak wrote: > > > > Wednesday, February 15, 2006, 8:31:17 PM, you wrote: > > OJ> Note that prior to 8.0 PostgreSQL does not support > > multiple ALTER actions in a single query. To get an > > equivalent effect, wrap separate ALTER TABLE qu

Re: [SQL] alter table

2006-02-15 Thread Owen Jacobson
Maciej Piekielniak wrote: > > Hello Owen, > > Wednesday, February 15, 2006, 8:56:05 PM, you wrote: > >> ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL; > > OJ> Not under 7.4. > > Hmm, maybe postgres can copy constraints and properties in > "create table .. as select"? What is it

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Owen, Wednesday, February 15, 2006, 8:56:05 PM, you wrote: >> ALTER TABLE proc MODIFY name varchar(64) DEFAULT '' NOT NULL; OJ> Not under 7.4. Hmm, maybe postgres can copy constraints and properties in "create table .. as select"? CREATE TABLE fv_wystawione ( abonament) AS SELECT a.nazwa

Re: [SQL] alter table

2006-02-15 Thread Owen Jacobson
Maciej Piekielniak wrote: > > Wednesday, February 15, 2006, 8:31:17 PM, you wrote: > OJ> Note that prior to 8.0 PostgreSQL does not support > multiple ALTER actions in a single query. To get an > equivalent effect, wrap separate ALTER TABLE queries in a transaction: > > OJ> BEGIN; > OJ> alter

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Owen, Wednesday, February 15, 2006, 8:31:17 PM, you wrote: OJ> Note that prior to 8.0 PostgreSQL does not support multiple ALTER actions in a single query. To get an equivalent effect, wrap separate ALTER TABLE queries in a transaction: OJ> BEGIN; OJ> alter table xyz alter column id set

Re: [SQL] alter table

2006-02-15 Thread Owen Jacobson
Andreas Kretschmer wrote: > > Maciej Piekielniak <[EMAIL PROTECTED]> schrieb: > > > Hello Andreas, > > > > Wednesday, February 15, 2006, 7:54:28 PM, you wrote: > > AK> test=# alter table xyz alter column id set default > nextval('xyz_seq'), alter column foo set default ''; > > > > PGAdmin-SQL:

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Andreas, Wednesday, February 15, 2006, 8:27:00 PM, you wrote: AK> test=# select version(); AK>version AK> -- AK> PostgreSQL 8.1.2

Re: [SQL] alter table

2006-02-15 Thread Andreas Kretschmer
Maciej Piekielniak <[EMAIL PROTECTED]> schrieb: > Hello Andreas, > > Wednesday, February 15, 2006, 7:54:28 PM, you wrote: > AK> test=# alter table xyz alter column id set default nextval('xyz_seq'), > alter column foo set default ''; > > PGAdmin-SQL: > > alter table xyz alter column id set def

Re: [SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello Andreas, Wednesday, February 15, 2006, 7:54:28 PM, you wrote: AK> test=# alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default ''; PGAdmin-SQL: alter table xyz alter column id set default nextval('xyz_seq'), alter column foo set default ''; ERROR:

Re: [SQL] alter table

2006-02-15 Thread Andreas Kretschmer
Maciej Piekielniak <[EMAIL PROTECTED]> schrieb: > Hello , > > How can i modify few fields with alter? > > ALTER TABLE fv_wystawione > ALTER id_fv SET DEFAULT nextval('id_fv_seq'::text), > ALTER imie SET DEFAULT ''; test=# create table xyz (id int not null); CREATE TABLE test=# create sequ

[SQL] alter table

2006-02-15 Thread Maciej Piekielniak
Hello , How can i modify few fields with alter? ALTER TABLE fv_wystawione ALTER id_fv SET DEFAULT nextval('id_fv_seq'::text), ALTER imie SET DEFAULT ''; Syntax error in last line. -- Best regards, Maciej mailto:[EMAIL PROTECTED] ---(en

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Alvaro Herrera
Ken Hill wrote: > On Wed, 2006-02-15 at 18:09 +0100, Peter Eisentraut wrote: > > > Ken Hill wrote: > > > Can someone point me in a > > > direction as to where I can learn how to modify the postgresql.org > > > file to increase work_mem? > > > > RTFM > > I apologize for my lack of knowledge, but

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Ken Hill
On Wed, 2006-02-15 at 18:09 +0100, Peter Eisentraut wrote: Ken Hill wrote: > Can someone point me in a > direction as to where I can learn how to modify the postgresql.org > file to increase work_mem? RTFM I apologize for my lack of knowledge, but what is "RTFM"?

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Owen Jacobson
Andrew Sullivan wrote: > > On Wed, Feb 15, 2006 at 08:15:46AM -0800, Ken Hill wrote: > > It has been suggested to me to increase my work_mem to make queries > > preform faster. I believe I do this in the 'postgresql.org' file. I > > seem to have two of these files: > > > > /etc/postgresql/7.4/ma

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Peter Eisentraut
Ken Hill wrote: > Can someone point me in a > direction as to where I can learn how to modify the postgresql.org > file to increase work_mem? RTFM -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of broadcast)--- TIP 1: if post

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Andrew Sullivan
On Wed, Feb 15, 2006 at 08:35:31AM -0800, Ken Hill wrote: > > This is how Ubuntu installed postgresql via it's synaptic package > manager. Ok, then I suspect you need to consult the Ubuntu docs about what they did differently. If my understanding of Ubuntu is correct, that should be under /usr/s

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Ken Hill
On Wed, 2006-02-15 at 11:20 -0500, Andrew Sullivan wrote: On Wed, Feb 15, 2006 at 08:15:46AM -0800, Ken Hill wrote: > It has been suggested to me to increase my work_mem to make queries > preform faster. I believe I do this in the 'postgresql.org' file. I > seem to have two of these files: >

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Devrim GUNDUZ
Hi, On Wed, 2006-02-15 at 08:15 -0800, Ken Hill wrote: > It has been suggested to me to increase my work_mem to make queries > preform faster. I believe I do this in the 'postgresql.org' file. I > seem to have two of these files: > > /etc/postgresql/7.4/main/postgresql.org > /usr/share/postgresq

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Andrew Sullivan
On Wed, Feb 15, 2006 at 08:15:46AM -0800, Ken Hill wrote: > It has been suggested to me to increase my work_mem to make queries > preform faster. I believe I do this in the 'postgresql.org' file. I > seem to have two of these files: > > /etc/postgresql/7.4/main/postgresql.org > /usr/share/postgre

[SQL] Modifying postgresql.org file

2006-02-15 Thread Ken Hill
It has been suggested to me to increase my work_mem to make queries preform faster. I believe I do this in the 'postgresql.org' file.  I seem to have two of these files: /etc/postgresql/7.4/main/postgresql.org /usr/share/postgresql/7.4/postgresql.conf.sample I believe the second one is an exa

Re: [SQL] Non Matching Records in Two Tables

2006-02-15 Thread Ken Hill
On Tue, 2006-02-14 at 15:05 -0800, Bryce Nesbitt wrote: Ken Hill wrote: >> also (hate to be obvious) have you analyzed lately? >> I'd say that's fair game, not obvious. Vacuum/Analyze is ar so aparent to a person moving to Postgres from other DB's. ---(end of b