Re: [PERFORM] Poor performance on very simple query ?

2006-10-04 Thread Markus Schaber
Hi, Tobias, Tobias Brox wrote: How can you have a default value on a primary key? Just declare the column with both a default value and a primary key constraint. It makes sense when the default value is calculated instead of a constant, by calling a function that generates the key. In fact,

[PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Arnaud Lesauvage
Hi List ! I have a performance problem, but I am not sure whether it really is a problem or not. I am running a fresh install of PostgreSQL 8.1.4 on Windows2000. The server is a bi-opteron with 2GB of RAM. The PostgreSQL's data folder is on a RAID-0 array of 2 SATA WD Raptor drives (10.000 rpm,

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Arnaud Lesauvage
Steinar H. Gunderson wrote: Total runtime: 0.801 ms 0.801 ms is _far_ under a second... Where do you have the latter timing from? I fell stupid... Sorry for the useless message... [] ---(end of broadcast)--- TIP 2: Don't 'kill -9'

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Alexander Staubo
On Oct 3, 2006, at 13:25 , Arnaud Lesauvage wrote: The problem is that simple select queries with the primary key in the WHERE statement take very long to run. For example, this query returns only 7 rows and takes about 1 second to run ! SELECT * FROM table1 WHERE gid in

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Tobias Brox
[Arnaud Lesauvage - Tue at 01:25:10PM +0200] I have a performance problem, but I am not sure whether it really is a problem or not. QUERY PLAN

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Tobias Brox
[Tobias Brox - Tue at 02:10:04PM +0200] Did you try analyze as well? It's weird it's using seq scan, since you have a primary key it's supposed to have an index ... though 500 rows is little. I just checked up our own production database, takes 0.08 ms to fetch a row by ID from one of our

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Arnaud Lesauvage
Tobias Brox wrote: Oh, the gid is not primary key. I guess I should also apologize for adding noise here :-) Yes, it is a primary key, but I am the noise maker here ! ;-) ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Tobias Brox
[Arnaud Lesauvage - Tue at 02:13:59PM +0200] Tobias Brox wrote: Oh, the gid is not primary key. I guess I should also apologize for adding noise here :-) Yes, it is a primary key, but I am the noise maker here ! ;-) Oh - it is. How can you have a default value on a primary key? Will it

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Arnaud Lesauvage
Tobias Brox wrote: [Arnaud Lesauvage - Tue at 02:13:59PM +0200] Tobias Brox wrote: Oh, the gid is not primary key. I guess I should also apologize for adding noise here :-) Yes, it is a primary key, but I am the noise maker here ! ;-) Oh - it is. How can you have a default value on a

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Guillaume Cottenceau
Tobias Brox tobias 'at' nordicbet.com writes: Oh - it is. How can you have a default value on a primary key? Will it you can but it is useless :) foo=# create table bar (uid int primary key default 0, baz text); NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index bar_pkey for

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Darcy Buskermolen
On October 3, 2006 04:25 am, Arnaud Lesauvage wrote: Hi List ! I have a performance problem, but I am not sure whether it really is a problem or not. I am running a fresh install of PostgreSQL 8.1.4 on Windows2000. The server is a bi-opteron with 2GB of RAM. The PostgreSQL's data folder is

Re: [PERFORM] Poor performance on very simple query ?

2006-10-03 Thread Darcy Buskermolen
On October 3, 2006 05:08 am, Alexander Staubo wrote: On Oct 3, 2006, at 13:25 , Arnaud Lesauvage wrote: The problem is that simple select queries with the primary key in the WHERE statement take very long to run. For example, this query returns only 7 rows and takes about 1 second to run