Re: [HACKERS] New cast between inet/cidr and bytea

2007-05-30 Thread Zoltan Boszormenyi
Tom Lane írta: Zoltan Boszormenyi <[EMAIL PROTECTED]> writes: we at Cybertec have developed cast functions in C between inet/cidr <-> bytea for a client and we would like to submit it. Why is this a good idea? Exposing the internal representation of a datatype is usually bad. I didn

Re: [HACKERS] New cast between inet/cidr and bytea

2007-05-30 Thread Zoltan Boszormenyi
Bruce Momjian írta: Zoltan Boszormenyi wrote: Hi, we at Cybertec have developed cast functions in C between inet/cidr <-> bytea for a client and we would like to submit it. This is how it works: - IPv4 inet/cidr value will return 4 bytes if the netmask covers all 32 bits. It returns 5 b

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Bruce Momjian
I tested EXTERN_TUPLES_PER_PAGE for values 4(default), 2, and 1: 4 15.596 2 15.197 1 14.6 which is basically a 3% decrease from 4->2 and 2->1. The test script and result are here: http://momjian.us/expire/TOAST2/ shared_buffers again was 32MB

Re: [HACKERS] Query plan degradation 8.2 --> 8.3

2007-05-30 Thread Josh Berkus
Greg, > How recently did you check out your 8.3 tree? It's the snapshot from 5/28, which means it was pulled from CVS on 5/27. So, recent. > When I run it I get a bitmap index scan which I think might mean you're > suffering from the same problem Tom found and fixed a few days ago. The > plann

[HACKERS] ERROR: index row size 2960 exceeds btree maximum

2007-05-30 Thread Rodrigo Sakai
Hello, I'm developing an application that needs a different data type. So, I have implemented this new data type inside postgresql using C, as documentation shows to. Basically, the data type is a composition of two timestamps, like: (timestamp, timestamp) and it is called 'period'. S

Re: [HACKERS] Style of file error messages

2007-05-30 Thread Joshua D. Drake
Gregory Stark wrote: "Tom Lane" <[EMAIL PROTECTED]> writes: A seasoned developer might only need the file name to guess what kind of file it is, but other people could probably use the help. I think Peter's argument is that what kind of file it is really doesn't help a regular user. Nonethele

Re: [HACKERS] Query plan degradation 8.2 --> 8.3

2007-05-30 Thread Gregory Stark
"Josh Berkus" <[EMAIL PROTECTED]> writes: > On Wednesday 30 May 2007 15:51, Josh Berkus wrote: >> I now have a simple test case which shows significant performance >> degradation on 8.3devel for a specific query, apparenly due to an >> unnecessary call to Top-N sort.  I've tried to forward the tes

Re: [HACKERS] Query plan degradation 8.2 --> 8.3

2007-05-30 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > I now have a simple test case which shows significant performance > degradation on 8.3devel for a specific query, apparenly due to an > unnecessary call to Top-N sort. It does the right thing if t_s_symb is declared as text instead of varchar. When it's

Re: [HACKERS] Query plan degradation 8.2 --> 8.3

2007-05-30 Thread Josh Berkus
On Wednesday 30 May 2007 15:51, Josh Berkus wrote: > I now have a simple test case which shows significant performance > degradation on 8.3devel for a specific query, apparenly due to an > unnecessary call to Top-N sort.  I've tried to forward the test case to > the lists but the package is 3.5m, s

[HACKERS] Query plan degradation 8.2 --> 8.3

2007-05-30 Thread Josh Berkus
All, I now have a simple test case which shows significant performance degradation on 8.3devel for a specific query, apparenly due to an unnecessary call to Top-N sort. I've tried to forward the test case to the lists but the package is 3.5m, so I'm putting it on pgFoundry instead: If you ru

Re: [HACKERS] New cast between inet/cidr and bytea

2007-05-30 Thread Tom Lane
Zoltan Boszormenyi <[EMAIL PROTECTED]> writes: > we at Cybertec have developed cast functions in C between > inet/cidr <-> bytea for a client and we would like to submit it. Why is this a good idea? Exposing the internal representation of a datatype is usually bad. What will you do when we add s

Re: [HACKERS] [COMMITTERS] pgsql: Make large sequential scans and VACUUMs work in a limited-size

2007-05-30 Thread Alvaro Herrera
Tom Lane wrote: > Log Message: > --- > Make large sequential scans and VACUUMs work in a limited-size "ring" of > buffers, rather than blowing out the whole shared-buffer arena. Aside from > avoiding cache spoliation, this fixes the problem that VACUUM formerly tended > to cause a WAL flus

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > Is there any way to tell, perhaps from the command string, that the process is > about to start exiting? What stage of exiting is it that we think the kernel > goes to lunch? I haven't really done any detailed investigation, but I would think that a simp

Re: [HACKERS] Padding on 64-bit

2007-05-30 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Magnus Hagander wrote: > >> I think that's backwards. We *are* passing them by reference, we should > >> be considering passing them by value. > > > Thanks, fixed. > > Also, the TODO item ought to mention float4 and float8, which IMH

Re: [HACKERS] Padding on 64-bit

2007-05-30 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Magnus Hagander wrote: >> I think that's backwards. We *are* passing them by reference, we should >> be considering passing them by value. > Thanks, fixed. Also, the TODO item ought to mention float4 and float8, which IMHO ought to be changed at the sam

Re: [HACKERS] Postmaster startup messages

2007-05-30 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Does anyone actually read these? > LOG: database system was shut down at 2007-05-30 17:54:39 CEST > LOG: checkpoint record is at 0/42C4FC > LOG: redo record is at 0/42C4FC; undo record is at 0/0; shutdown TRUE > LOG: next transaction ID: 0/593; nex

Re: [HACKERS] Style of file error messages

2007-05-30 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > A seasoned developer might only need the file name to guess what kind of > file it is, but other people could probably use the help. I think Peter's argument is that what kind of file it is really doesn't help a regular user. Nonetheless I agree strongly.

Re: [HACKERS] Padding on 64-bit

2007-05-30 Thread Bruce Momjian
Magnus Hagander wrote: > I think that's backwards. We *are* passing them by reference, we should > be considering passing them by value. Thanks, fixed. --- > > //Magnus > > > Bruce Momjian wrote: > > Added to TODO: > >

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Josh Berkus
Tom, > Even if we had a semaphore of the sort you suggest, I doubt people would > want DROP DATABASE to wait indefinitely. The real question here is how > long is it reasonable for DROP DATABASE to wait before failing ... 10 to 15 seconds, I'd say. Is that going to be long enough for backends t

Re: [HACKERS] Padding on 64-bit

2007-05-30 Thread Magnus Hagander
I think that's backwards. We *are* passing them by reference, we should be considering passing them by value. //Magnus Bruce Momjian wrote: > Added to TODO: > > * Consider allowing 64-bit integers to be passed by reference on 64-bit > platforms > > >

Re: [HACKERS] Padding on 64-bit

2007-05-30 Thread Bruce Momjian
Added to TODO: * Consider allowing 64-bit integers to be passed by reference on 64-bit platforms --- Neil Conway wrote: > On Tue, 2007-29-05 at 16:01 -0400, Tom Lane wrote: > > (I imagine someday we'll get around to allo

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > However, it suddenly struck me that we could probably make most of the > problem go away if we put that same wait into DROP DATABASE itself --- that > is, if we see other backends in the target DB, sleep for a second or two and > then recheck before errori

Re: [HACKERS] libedit-preferred by default

2007-05-30 Thread Neil Conway
On Mon, 2007-28-05 at 15:24 -0400, Tom Lane wrote: > readline has much more functionality Fair enough, that's probably a good enough reason to leave things as they are for now. -Neil ---(end of broadcast)--- TIP 5: don't forget to increase your f

Re: [HACKERS] Changing checkpoint_timeout to another name?

2007-05-30 Thread Bruce Momjian
Joshua D. Drake wrote: > Joshua D. Drake wrote: > > Hello, > > > > I am currently writing some curriculum on managing IO with PostgreSQL > > and I keep running into the parameter checkpolint_timeout. > *cough* checkpoint_timeout > > This seems to > > be incorrect as it is not really a timeout

Re: [HACKERS] New cast between inet/cidr and bytea

2007-05-30 Thread Bruce Momjian
Zoltan Boszormenyi wrote: > Hi, > > we at Cybertec have developed cast functions in C between > inet/cidr <-> bytea for a client and we would like to submit it. > > This is how it works: > - IPv4 inet/cidr value will return 4 bytes if the netmask covers all 32 > bits. > It returns 5 bytes if t

Re: [HACKERS] Changing checkpoint_timeout to another name?

2007-05-30 Thread Joshua D. Drake
Joshua D. Drake wrote: Hello, I am currently writing some curriculum on managing IO with PostgreSQL and I keep running into the parameter checkpolint_timeout. *cough* checkpoint_timeout This seems to be incorrect as it is not really a timeout as much as an interval... Thoughts? Sincerely,

[HACKERS] Changing checkpoint_timeout to another name?

2007-05-30 Thread Joshua D. Drake
Hello, I am currently writing some curriculum on managing IO with PostgreSQL and I keep running into the parameter checkpolint_timeout. This seems to be incorrect as it is not really a timeout as much as an interval... Thoughts? Sincerely, Joshua D. Drake -- === The PostgreSQL Compa

[HACKERS] New cast between inet/cidr and bytea

2007-05-30 Thread Zoltan Boszormenyi
Hi, we at Cybertec have developed cast functions in C between inet/cidr <-> bytea for a client and we would like to submit it. This is how it works: - IPv4 inet/cidr value will return 4 bytes if the netmask covers all 32 bits. It returns 5 bytes if the netmask is shorter than 32 bits. - Simil

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Tom Lane
Brian Hurt <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> I just finished giving someone the standard advice to wait a bit before >> trying to drop a database that'd just been accessed: >> http://archives.postgresql.org/pgsql-general/2007-05/msg01505.php > Is this a synchronization issue? The p

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Heikki Linnakangas
Bruce Momjian wrote: What you will see is that pushing TEXT to a TOAST column allows quick access to non-TOAST values and single-row TOAST values, but accessing all TOAST columns is slower than accessing them in the heap, by a factor of 3-18x. Looking at the chart, it seems 512 is the proper bre

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Tom Lane
Magnus Hagander <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> AFAICT a "real" fix for this would involve making PQfinish() synchronous >> (don't return till backend is dead), which doesn't seem like a great >> idea. However, it suddenly struck me that we could probably make most >> of the probl

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Brian Hurt
Tom Lane wrote: I just finished giving someone the standard advice to wait a bit before trying to drop a database that'd just been accessed: http://archives.postgresql.org/pgsql-general/2007-05/msg01505.php AFAICT a "real" fix for this would involve making PQfinish() synchronous (don't return t

Re: [HACKERS] Style of file error messages

2007-05-30 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Just to get an opinion, which is better: > could not open whatever file "%s": %m > or just: > could not open file "%s": %m > It seems to me that by the time you get to a file error message of this > level, the higher-level purpose of the file is pret

Re: [HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Magnus Hagander
Tom Lane wrote: > I just finished giving someone the standard advice to wait a bit before > trying to drop a database that'd just been accessed: > http://archives.postgresql.org/pgsql-general/2007-05/msg01505.php > > AFAICT a "real" fix for this would involve making PQfinish() synchronous > (don't

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Gregory Stark
"Bruce Momjian" <[EMAIL PROTECTED]> writes: > Uh, am I supposed to be running more TOAST tests? Would someone explain > what they want tested? If you want my opinion I would say we need two tests: 1) For TOAST_TUPLE_TARGET: We need to run the test scripts you have already for sizes that cause

Re: [HACKERS] Style of file error messages

2007-05-30 Thread Joshua D. Drake
Peter Eisentraut wrote: Just to get an opinion, which is better: could not open transaction log file "%s": %m could not open control file "%s": %m could not open data file "%s": %m could not open temporary file "%s": %m could not open whatever file "%s": %m or just: could not open file "%s": %

[HACKERS] Ye olde drop-the-database-you-just-left problem

2007-05-30 Thread Tom Lane
I just finished giving someone the standard advice to wait a bit before trying to drop a database that'd just been accessed: http://archives.postgresql.org/pgsql-general/2007-05/msg01505.php AFAICT a "real" fix for this would involve making PQfinish() synchronous (don't return till backend is dead

Re: [HACKERS] 'Waiting on lock'

2007-05-30 Thread Stephen Frost
* Tom Lane ([EMAIL PROTECTED]) wrote: > Stephen Frost <[EMAIL PROTECTED]> writes: > > * Tom Lane ([EMAIL PROTECTED]) wrote: > >> It'd be relatively painless to make that happen as part of the > >> deadlock-check timeout function, but that's typically only a one-second > >> delay not a "few seconds"

[HACKERS] table partitioning pl/pgsql helpers

2007-05-30 Thread Enrico Sirola
Hello, I'm trying to write a trigger on insert which should insert the row in another table. The table on which to insert the row should be selected at runtime and it is not know in advance. For example, let's say we have a table with two columns, a date and an integer. a row is inserted int

Re: [HACKERS] 'Waiting on lock'

2007-05-30 Thread Stephen Frost
* Alvaro Herrera ([EMAIL PROTECTED]) wrote: > Stephen Frost wrote: > > Yeah, I wouldn't want one per second. > > It's not one per second, it's after one second (actually > deadlock_timeout) has elapsed since you started to sleep waiting for a > lock. If a deadlock is not detected the process won'

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Bruce Momjian
Tom Lane wrote: > Gregory Stark <[EMAIL PROTECTED]> writes: > > Whereas if you set toast_tuples_per_page to 8k then the only option for > > Postgres will be to put each datum in its own page and waste 1-3k on every > > page. > > No, because actually the code is designed to make the toast chunk siz

Re: [HACKERS] 'Waiting on lock'

2007-05-30 Thread Alvaro Herrera
Stephen Frost wrote: > * Tom Lane ([EMAIL PROTECTED]) wrote: > > Stephen Frost <[EMAIL PROTECTED]> writes: > > > It'd be nice to have a NOTICE printed when a wait-on-lock takes longer > > > than a few seconds. > > > > It'd be relatively painless to make that happen as part of the > > deadlock-

Re: [HACKERS] 'Waiting on lock'

2007-05-30 Thread Tom Lane
Stephen Frost <[EMAIL PROTECTED]> writes: > * Tom Lane ([EMAIL PROTECTED]) wrote: >> It'd be relatively painless to make that happen as part of the >> deadlock-check timeout function, but that's typically only a one-second >> delay not a "few seconds". I think it'd likely be overly chatty. > Yeah

[HACKERS] Style of file error messages

2007-05-30 Thread Peter Eisentraut
Just to get an opinion, which is better: could not open transaction log file "%s": %m could not open control file "%s": %m could not open data file "%s": %m could not open temporary file "%s": %m could not open whatever file "%s": %m or just: could not open file "%s": %m It seems to me that by

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Zeugswetter Andreas ADI SD
> > Whereas if you set toast_tuples_per_page to 8k then the only option > > for Postgres will be to put each datum in its own page and > waste 1-3k > > on every page. > > No, because actually the code is designed to make the toast > chunk size just enough less than 8K that the tuples fit. He

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > The shorter-than-normal tuples carrying the last chunk of any particular > datum are going to result in wasted space to the extent that we can't > pack them together on a page, but that's true now. Right now, if you > have a large toasted datum, it mostly

[HACKERS] Postmaster startup messages

2007-05-30 Thread Peter Eisentraut
Does anyone actually read these? LOG: database system was shut down at 2007-05-30 17:54:39 CEST LOG: checkpoint record is at 0/42C4FC LOG: redo record is at 0/42C4FC; undo record is at 0/0; shutdown TRUE LOG: next transaction ID: 0/593; next OID: 10820 LOG: next MultiXactId: 1; next MultiXact

Re: [HACKERS] 'Waiting on lock'

2007-05-30 Thread Stephen Frost
* Tom Lane ([EMAIL PROTECTED]) wrote: > Stephen Frost <[EMAIL PROTECTED]> writes: > > It'd be nice to have a NOTICE printed when a wait-on-lock takes longer > > than a few seconds. > > It'd be relatively painless to make that happen as part of the > deadlock-check timeout function, but that's

Re: [HACKERS] 'Waiting on lock'

2007-05-30 Thread Tom Lane
Stephen Frost <[EMAIL PROTECTED]> writes: > It'd be nice to have a NOTICE printed when a wait-on-lock takes longer > than a few seconds. It'd be relatively painless to make that happen as part of the deadlock-check timeout function, but that's typically only a one-second delay not a "few secon

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > Whereas if you set toast_tuples_per_page to 8k then the only option for > Postgres will be to put each datum in its own page and waste 1-3k on every > page. No, because actually the code is designed to make the toast chunk size just enough less than 8K t

[HACKERS] 'Waiting on lock'

2007-05-30 Thread Stephen Frost
Greetings, It'd be nice to have a NOTICE printed when a wait-on-lock takes longer than a few seconds. It doesn't need to be precise and it doesn't have to be repeated over and over, just once. Perhaps even controlled by a GUC, though NOTICEs are generally ignored by non-interactive app

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > "Zeugswetter Andreas ADI SD" <[EMAIL PROTECTED]> writes: >> My expectation would be, that we want to allow a toast tuple to fill a >> whole page (TOAST_TUPLES_PER_PAGE = 1), I thought that previously but then I started thinking maybe that's not true. Pic

Re: [HACKERS] Passing parameters to a C function

2007-05-30 Thread Tom Lane
Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > On Wed, May 30, 2007 at 11:26:01AM -0300, Rodrigo Sakai wrote: >> But using version 1 calling convention it won't work! So, how can I pass the >> 'a' and 'b' variables in complex_add(?, ?)? > Use the DirectFunctionCalln functions in fmgr. There

Re: [HACKERS] Passing parameters to a C function

2007-05-30 Thread Martijn van Oosterhout
On Wed, May 30, 2007 at 11:26:01AM -0300, Rodrigo Sakai wrote: >I have a question about passing parameters to a C function. Imagine the > example by PostgreSQL: > > PG_FUNCTION_INFO_V1(complex_add); > But using version 1 calling convention it won't work! So, how can I pass the > 'a' and 'b'

[HACKERS] Passing parameters to a C function

2007-05-30 Thread Rodrigo Sakai
Hello, I have a question about passing parameters to a C function. Imagine the example by PostgreSQL: PG_FUNCTION_INFO_V1(complex_add); Datum complex_add(PG_FUNCTION_ARGS) { Complex*a = (Complex *) PG_GETARG_POINTER(0); Complex*b = (Complex *) PG_GETARG_P

Re: [HACKERS] msvc, build and install with cygwin in the PATH

2007-05-30 Thread Magnus Hagander
On Wed, May 30, 2007 at 01:56:24PM +0200, Hannes Eder wrote: > Magnus Hagander schrieb: > >Are you actually *running* the script from inside cygwin? How else does it > >pick up the wrong command processor? > > > I run the script within cmd.exe, but cygwin´s /usr/bin directory is in > my PATH, th

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Tom Lane
"Zeugswetter Andreas ADI SD" <[EMAIL PROTECTED]> writes: > My expectation would be, that we want to allow a toast tuple to fill a > whole page (TOAST_TUPLES_PER_PAGE = 1), I've been wondering about that too. It certainly needs to be experimented with, independently of TOAST_TUPLE_THRESHOLD, now t

Re: [HACKERS] msvc, build and install with cygwin in the PATH

2007-05-30 Thread Hannes Eder
Magnus Hagander schrieb: Are you actually *running* the script from inside cygwin? How else does it pick up the wrong command processor? I run the script within cmd.exe, but cygwin´s /usr/bin directory is in my PATH, therefor cygwin dir executable is in the PATH (/usr/bin/dir). Instead of ru

Re: [HACKERS] TOAST usage setting

2007-05-30 Thread Zeugswetter Andreas ADI SD
> I reran the tests with hashtext(), and created a SUMMARY.HTML chart: > > http://momjian.us/expire/TOAST/ > > What you will see is that pushing TEXT to a TOAST column > allows quick access to non-TOAST values and single-row TOAST > values, but accessing all TOAST columns is slower than

Re: [HACKERS] msvc, build and install with cygwin in the PATH

2007-05-30 Thread Magnus Hagander
On Wed, May 30, 2007 at 12:09:05PM +0200, Hannes Eder wrote: > Andrew Dunstan schrieb: > >Hannes Eder wrote: > >>-open($D, "dir /b $subdirs $spec |") || croak "Could not list > >>$spec\n"; > >>+open($D, "cmd /c dir /b $subdirs $spec |") || croak "Could not > >>list $spec\n"; > >> > > > >

Re: [HACKERS] msvc, build and install with cygwin in the PATH

2007-05-30 Thread Hannes Eder
Andrew Dunstan schrieb: Hannes Eder wrote: -open($D, "dir /b $subdirs $spec |") || croak "Could not list $spec\n"; +open($D, "cmd /c dir /b $subdirs $spec |") || croak "Could not list $spec\n"; What the heck are we doing here anyway? We should be doing this a la Perl - calling out