Re: [GENERAL] tup_returned/ tup_fetched

2008-12-14 Thread Gregory Stark
Sebastian Böhm writes: > one question: > > what actually is tup_returned and tup_fetched ? RTFM -- admittedly it's not so easy to find these since you have to know they come from the following functions: pg_stat_get_tuples_returned(oid) bigint Number of rows read by sequential scans when argum

[GENERAL] tup_returned/ tup_fetched

2008-12-14 Thread Sebastian Böhm
Hi, one question: what actually is tup_returned and tup_fetched ? read from disc before scans and before aggregate ? thanks sebastian

Re: [GENERAL] Is index enough to do simple fetch, or table is always used too?

2008-12-14 Thread David Rowley
2008/12/14 Dmitry Koterov : > > On Sun, Dec 14, 2008 at 3:36 PM, David Rowley wrote: >> >> 2008/12/14 Dmitry Koterov : >> > The question: if the table "tbl" scanned to fetch "id" and calculate >> > md5(id), or the value of "id" is brought directly from "idx" index with >> > no >> > table data acce

Re: [GENERAL] Is index enough to do simple fetch, or table is always used too?

2008-12-14 Thread Dmitry Koterov
On Sun, Dec 14, 2008 at 3:36 PM, David Rowley wrote: > 2008/12/14 Dmitry Koterov : > > The question: if the table "tbl" scanned to fetch "id" and calculate > > md5(id), or the value of "id" is brought directly from "idx" index with > no > > table data access at all? The second behaviour is logica

Re: [GENERAL] application readable error message

2008-12-14 Thread Raymond O'Donnell
On 13/12/2008 19:13, SunWuKung wrote: > I am trying to return an application error message on certain db > raised errors to the form the info came from. > What is the usual way for an application to identify the source of an I suppose it depends on your development language/environment I use

Re: [GENERAL] how to find foreign key details (column, that is)

2008-12-14 Thread Tom Lane
Karsten Hilbert writes: > This is what my 8.3 manual says: > conkey │ int2[] │ pg_attribute.attnum │ If a table constraint, list of > columns which the constraint constrains │ > From that I wouldn't have figured it'd apply to foreign keys > as well. So I assume it is fair to say that "f

Re: [GENERAL] how to find foreign key details (column, that is)

2008-12-14 Thread Karsten Hilbert
On Sun, Dec 14, 2008 at 02:37:51PM -0500, Tom Lane wrote: > Subject: Re: [GENERAL] how to find foreign key details (column, that is) > > Karsten Hilbert writes: > > I cannot, however, for the life of it find out how to learn > > the *column* the foreign key is on. > > pg_constraint.conkey has t

Re: [GENERAL] how to find foreign key details (column, that is)

2008-12-14 Thread Tom Lane
Karsten Hilbert writes: > I cannot, however, for the life of it find out how to learn > the *column* the foreign key is on. pg_constraint.conkey has the referencing columns' numbers. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

[GENERAL] from 2 keys to serial

2008-12-14 Thread Ivan Sergio Borgonovo
I've to import something whose schema looks like create table user( userid serial primary key, ); create table adresses_source( userid int references user(userid), addressid int ); where addressid are a sequence for each userid as: 1,1 1,2 1,3 2,1 2,2 3,1 4,1 4,2 4,3 to something that sh

[GENERAL] how to find foreign key details (column, that is)

2008-12-14 Thread Karsten Hilbert
Hello all, suppose I know that there are several tables with foreign keys pointing to demographics.identity.pk With the help of pg_constraint I can get a list of *tables* which hold those foreign keys (schema = demographics, tbl = identity, col = pk): select %(schema)s as refer

[GENERAL] log rotate and open connections

2008-12-14 Thread Bob Gobeille
I'm on 8.1 and having a client hang on log rotates. To make the problem easier to duplicate, log rotates were set to two minutes: redirect_stderr = on# Enable capturing of stderr into log log_directory = 'pg_log'# enabled for 2 minute rotation test log_

Re: [GENERAL] Relational database design book

2008-12-14 Thread Rich Shepard
On Sun, 14 Dec 2008, Michael Hall wrote: I'm wondering if anyone can recommend a good general book on relational database design. ... Mick, I highly recommend all the books by Joe Celko. He's been writing on database issues for at least 20 years and communicates very well. I know that he h

[GENERAL] Urgente error in restore prod

2008-12-14 Thread paulo matadr
Hi guys, i need urgent help with this error: pg_restore: [archiver (db)] error returned by PQputCopyData: cannot allocate memory for output buffer im my restore . any idea with solve this error? Paulo Moraes Veja quais são os assuntos do momento no Yahoo! +Buscados http://br.maisbuscados.y

Re: [GENERAL] Is index enough to do simple fetch, or table is always used too?

2008-12-14 Thread David Rowley
2008/12/14 Dmitry Koterov : > Hello. > > Suppose I have the following index: > > CREATE INDEX idx ON tbl USING btree (abc, def, id) > > and perform the query with index scan: > > SELECT md5(id) > FROM tbl > WHERE abc=1 AND def=2 > LIMIT 200 > > The question: if the table "tbl" scanned to fetch "id

[GENERAL] Is index enough to do simple fetch, or table is always used too?

2008-12-14 Thread Dmitry Koterov
Hello. Suppose I have the following index: CREATE INDEX idx ON tbl USING btree (abc, def, id) and perform the query with index scan: SELECT md5(id) FROM tbl WHERE abc=1 AND def=2 LIMIT 200 *The question:* if the table "tbl" scanned to fetch "id" and calculate md5(id), or the value of "id" is

[GENERAL] Relational database design book

2008-12-14 Thread Michael Hall
This is slightly off topic perhaps, but maybe not too much ... I'm wondering if anyone can recommend a good general book on relational database design. I am using PostgreSQL, so a PG-centric book would be best, but I'm mainly interested in the art/science of good SQL database design regardless