Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Markus Wanner
Hi, Robert Hodges wrote: I like Simon’s logical vs. physical terminology So far, it seems to mainly have caused confusion (physical replication, but logical application? logical replication using WAL shipping?). At least I still prefer the more meaningful and descriptive terms, like log

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Markus Wanner
Hi, Alvaro Herrera wrote: Actually I think the idea here is to take certain WAL records, translate them into portable constructs, ship them, At which point it clearly shouldn't be called a WAL shipping method. What would it have to do with the WAL at all, then? Why translate from WAL

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Simon Riggs
On Tue, 2008-08-12 at 13:33 -0400, Bruce Momjian wrote: Simon Riggs wrote: with values of: nothing:have network traffic send WAL as needed netflush: wait for flush of WAL network packets to slave process:wait for slave to process

Re: [HACKERS] temporary statistics option at initdb time

2008-08-13 Thread Magnus Hagander
Tom Lane wrote: Decibel! [EMAIL PROTECTED] writes: I disagree. While we don't guarantee stats are absolutely up-to-date, or atomic I don't think that gives license for them to just magically not exist sometimes. Would it really be that hard to have the system copy the file out before

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Magnus Hagander
Tom Lane wrote: Magnus Hagander [EMAIL PROTECTED] writes: Andrew Gierth wrote: That's easily solved: when the client wants to do a cancel, have it send, in place of the actual cancel key, an integer N and the value HMAC(k,N) where k is the cancel key. Replay is prevented by requiring the

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Markus Wanner
Hi, Robert Hodges wrote: Part of this is semantics—I like Simon’s logical vs. physical terminology because it distinguishes neatly between replication that copies implementation down to OIDs etc. and replication that copies data content including schema changes but not implementation. So

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Simon Riggs
On Tue, 2008-08-12 at 23:22 -0400, Tom Lane wrote: Gregory Stark [EMAIL PROTECTED] writes: On Tue, 2008-08-12 at 15:46 -0400, Tom Lane wrote: This is only going to matter for a table of 1 block (or at least very few blocks), and for such a table it's highly likely that it's in RAM

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Stephen R. van den Berg
Tom Lane wrote: [ thinks for a bit... ] You could make it a change in the cancel protocol, which is to some extent independent of the main FE/BE protocol. The problem is: how can the client know whether it's okay to use this new protocol for cancel? Two options: a. Send two cancelkeys in rapid

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Gregory Stark
Magnus Hagander [EMAIL PROTECTED] writes: Yeah, that's the point that will require a protocol bump, I think. Since there is no response to the cancel packet, we can't even do things like sending in a magic key and look at the response (which would be a rather ugly hack, but doable if we had a

[HACKERS] C Extension woes

2008-08-13 Thread Tim Hawes
Hello all, I am trying to write an extension in C that returns a simple environment variable. The code compiles without any complaint or warning, and it loads fine into the database, however, when I run the function, I get disconnected from the server. Here is my C code: #include

Re: [HACKERS] C Extension woes

2008-08-13 Thread Jan Urbański
Tim Hawes wrote: Hello all, I am trying to write an extension in C that returns a simple environment variable. The code compiles without any complaint or warning, and it loads fine into the database, however, when I run the function, I get disconnected from the server. Here is my C code:

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Magnus Hagander
Gregory Stark wrote: Magnus Hagander [EMAIL PROTECTED] writes: Yeah, that's the point that will require a protocol bump, I think. Since there is no response to the cancel packet, we can't even do things like sending in a magic key and look at the response (which would be a rather ugly hack,

Re: [HACKERS] C Extension woes

2008-08-13 Thread Andrew Chernow
Tim Hawes wrote: text * pl_masterkey(PG_FUNCTION_ARGS) { char *e_var = getenv(PGMASTERKEY); size_t length = VARSIZE(e_var) - VARHDRSZ; The VARSIZE macro is for variable length structures, like a text or bytea which contains a length and data member. You are using this macro on a

[HACKERS] Patch: propose to include 3 new functions into intarray and intagg

2008-08-13 Thread Dmitry Koterov
Hello. Here are these functions with detailed documentation: http://en.dklab.ru/lib/dklab_postgresql_patch/ intagg.int_array_append_aggregate(int[]): fast merge arrays into one large list intarray._int_group_count_sort(int[], bool): frequency-based sorting intarray.bidx(int[], int): binary

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Simon Riggs
On Wed, 2008-08-13 at 11:27 +0200, Markus Wanner wrote: Hi, Robert Hodges wrote: Part of this is semantics—I like Simon’s logical vs. physical terminology because it distinguishes neatly between replication that copies implementation down to OIDs etc. and replication that copies data

Re: [HACKERS] temporary statistics option at initdb time

2008-08-13 Thread Magnus Hagander
Magnus Hagander wrote: Tom Lane wrote: Decibel! [EMAIL PROTECTED] writes: I disagree. While we don't guarantee stats are absolutely up-to-date, or atomic I don't think that gives license for them to just magically not exist sometimes. Would it really be that hard to have the system copy

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Markus Wanner
Hi, Simon Riggs wrote: Classification of Replication Techniques Thanks for your classifications. It helps a great deal to clarify. Type 2 is where you ship the WAL (efficient) then use it to reconstruct SQL (flexible) and then apply that to other nodes. It is somewhat harder than type 1,

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Stephen R. van den Berg
Magnus Hagander wrote: Gregory Stark wrote: Magnus Hagander [EMAIL PROTECTED] writes: We could have the server indicate it's the new protocol by sending the initial cancel key twice. If the client sees more than one cancel key it automatically switches to new-style cancel messages. That

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Simon Riggs
On Wed, 2008-08-13 at 15:38 +0200, Markus Wanner wrote: Simon Riggs wrote: Classification of Replication Techniques Thanks for your classifications. It helps a great deal to clarify. Type 2 is where you ship the WAL (efficient) then use it to reconstruct SQL (flexible) and then apply

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Magnus Hagander
Stephen R. van den Berg wrote: Magnus Hagander wrote: Gregory Stark wrote: Magnus Hagander [EMAIL PROTECTED] writes: We could have the server indicate it's the new protocol by sending the initial cancel key twice. If the client sees more than one cancel key it automatically switches to

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes: What would work is using a parameter field, per Stephen's suggestion elsewhere in the thread. Older libpq versions should just ignore the parameter if they don't know what it is. +1 for that one; we have done it already for several send-at-startup

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Magnus Hagander
Tom Lane wrote: Magnus Hagander [EMAIL PROTECTED] writes: What would work is using a parameter field, per Stephen's suggestion elsewhere in the thread. Older libpq versions should just ignore the parameter if they don't know what it is. +1 for that one; we have done it already for several

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Tom Lane
Magnus Hagander [EMAIL PROTECTED] writes: Tom Lane wrote: * Server accepts two different styles of cancel messages, identified by different protocol numbers. With the additional point that there is a GUC variable to turn this off or warn about it, right? I see pretty much no value in that.

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Magnus Hagander
Tom Lane wrote: Magnus Hagander [EMAIL PROTECTED] writes: Tom Lane wrote: * Server accepts two different styles of cancel messages, identified by different protocol numbers. With the additional point that there is a GUC variable to turn this off or warn about it, right? I see pretty

Re: [HACKERS] C Extension woes

2008-08-13 Thread Tom Lane
Andrew Chernow [EMAIL PROTECTED] writes: Tim Hawes wrote: char *e_var = getenv(PGMASTERKEY); size_t length = VARSIZE(e_var) - VARHDRSZ; The VARSIZE macro is for variable length structures, like a text or bytea which contains a length and data member. You are using this macro on a regular

Re: [HACKERS] Overhauling GUCS

2008-08-13 Thread Michael Nacos
Hi there... Configuration autotuning is something I am really interested in. I have seen this page: http://wiki.postgresql.org/wiki/GUCS_Overhaul and a couple of emails mentioning this, so I wanted to ask is someone already on it? If yes, I'd like to contribute. Ideally, an external little app

Re: [HACKERS] C Extension woes

2008-08-13 Thread Tim Hawes
Thank you for your replies, however, it still is not working, see below... Andrew Chernow wrote: Tim Hawes wrote: text * pl_masterkey(PG_FUNCTION_ARGS) { char *e_var = getenv(PGMASTERKEY); size_t length = VARSIZE(e_var) - VARHDRSZ; The VARSIZE macro is for variable length structures,

Re: [HACKERS] Uncopied parameters on CREATE TABLE LIKE

2008-08-13 Thread Bruce Momjian
Added to TODO: o Add CREATE TABLE LIKE ... INCLUDING COMMENTS * Allow table and index WITH options to be specified via hooks, for use with plugins like GiST index methods --- ITAGAKI Takahiro wrote: Simon

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Kevin Grittner
Tom Lane [EMAIL PROTECTED] wrote: BTW, should we make all of this conditional on the use of an SSL connection? If the original sending of the cancel key isn't secure against sniffing, it's hard to see what anyone is buying with all the added computation. +1 All of our important

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Bruce Momjian
Simon Riggs wrote: On Wed, 2008-08-13 at 15:38 +0200, Markus Wanner wrote: Simon Riggs wrote: Classification of Replication Techniques Thanks for your classifications. It helps a great deal to clarify. Type 2 is where you ship the WAL (efficient) then use it to reconstruct

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Bruce Momjian
Simon Riggs wrote: The main point of the post is that the parameter would be transaction controlled, so *must* be set in the transaction and thus *must* be set on the master. Otherwise the capability is not available in the way I am describing. Oh, so synchronous_commit would not

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Zeugswetter Andreas OSB sIT
Proposal: Make the first block of a seq scan cost random_page_cost, then after that every additional block costs seq_page_cost. +1 AFAICS the cost cross-over is much higher than the actual elapsed time cross-over for both narrow and wide tables. Which makes absolute sense, since

Re: [HACKERS] temporary statistics option at initdb time

2008-08-13 Thread Decibel!
On Aug 13, 2008, at 4:12 AM, Magnus Hagander wrote: Tom Lane wrote: Decibel! [EMAIL PROTECTED] writes: I disagree. While we don't guarantee stats are absolutely up-to- date, or atomic I don't think that gives license for them to just magically not exist sometimes. Would it really be that

Re: [HACKERS] benchmark farm

2008-08-13 Thread Jaime Casanova
On 1/21/08, Andrew Dunstan [EMAIL PROTECTED] wrote: It's on my (very long) TODO list to add benchmarking as an option on the buildfarm. If you're interested in working on it then contact me offline and we will work on how to move forward. any move in this? -- regards, Jaime Casanova

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Simon Riggs
On Wed, 2008-08-13 at 11:17 -0400, Bruce Momjian wrote: I think doing the WAL streaming and allowing a read-only slave is enough work to keep Simon busy for quite some time. I don't understand why the logical issue is being discussed at this stage --- let's get the other stuff done first.

Re: [HACKERS] C Extension woes

2008-08-13 Thread Jan Urbański
Tim Hawes wrote: @Jan: It appears the cstring_to_text function is unique to the latest PostgreSQL code. I do not have a def for that for PostgreSQL 8.2, and Oh, I'm sorry, I forgot about that. cstring_to_text has been added only recently (it's not even it 8.3, silly me). Datum

Re: [HACKERS] C Extension woes

2008-08-13 Thread Tim Hawes
Ok, that worked! Thank you very much, Jan and others who gave their input. I did see Tom's input for the VARHDRSZ and tried that, but forgot to add that again when I called VARATT_SIZEP Jan Urbański wrote: Tim Hawes wrote: @Jan: It appears the cstring_to_text function is unique to the

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Simon Riggs
On Wed, 2008-08-13 at 11:27 -0400, Bruce Momjian wrote: I disagree. If they make it the master they change the setting. It's not acceptable to force people to edit a configuration file when failover occurs. Some people wish to automate this and fumbling parameter values at this important time

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Decibel!
On Aug 12, 2008, at 4:52 PM, Andrew Gierth wrote: Tom == Tom Lane [EMAIL PROTECTED] writes: Proposal: Make the first block of a seq scan cost random_page_cost, then after that every additional block costs seq_page_cost. ?Tom This is only going to matter for a table of 1 block (or at least

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Bruce Momjian
Simon Riggs wrote: On Wed, 2008-08-13 at 11:17 -0400, Bruce Momjian wrote: I think doing the WAL streaming and allowing a read-only slave is enough work to keep Simon busy for quite some time. I don't understand why the logical issue is being discussed at this stage --- let's get the

Re: [HACKERS] temporary statistics option at initdb time

2008-08-13 Thread Magnus Hagander
Decibel! wrote: On Aug 13, 2008, at 4:12 AM, Magnus Hagander wrote: Tom Lane wrote: Decibel! [EMAIL PROTECTED] writes: I disagree. While we don't guarantee stats are absolutely up-to-date, or atomic I don't think that gives license for them to just magically not exist sometimes. Would it

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Bruce Momjian
Simon Riggs wrote: On Wed, 2008-08-13 at 11:27 -0400, Bruce Momjian wrote: I disagree. If they make it the master they change the setting. It's not acceptable to force people to edit a configuration file when failover occurs. Some people wish to automate this and fumbling parameter

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Marko Kreen
On 8/8/08, Heikki Linnakangas [EMAIL PROTECTED] wrote: It occurred to me a while ago that our query cancel messages are sent unencrypted, even when SSL is otherwise used. That's not a big issue on its own, because the cancellation message only contains the backend PID and the cancellation key,

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Andrew Gierth
Decibel! == Decibel! [EMAIL PROTECTED] writes: Decibel Roughly what I get on my MBP (I'm about a factor of 2 Decibel slower). This makes me think it's an issue of having to slog Decibel through an entire page one row at a time vs just using the Decibel index. To test this I tested selecting

Re: [HACKERS] Transaction-controlled robustness for replication

2008-08-13 Thread Simon Riggs
On Wed, 2008-08-13 at 12:55 -0400, Bruce Momjian wrote: NTT is working with EnterpriseDB on the WAL steaming code to be released to the community. Hopefully the code isn't steaming... :-) and that we will be able to see detailed designs and code soon. Might end up as a big pileup otherwise.

Re: [HACKERS] benchmark farm

2008-08-13 Thread Andy Colson
Jaime Casanova wrote: On 1/21/08, Andrew Dunstan [EMAIL PROTECTED] wrote: It's on my (very long) TODO list to add benchmarking as an option on the buildfarm. If you're interested in working on it then contact me offline and we will work on how to move forward. any move in this? Not much

Re: [HACKERS] Replay attack of query cancel

2008-08-13 Thread Heikki Linnakangas
On Wed, 13 Aug 2008, Marko Kreen wrote: On 8/8/08, Heikki Linnakangas [EMAIL PROTECTED] wrote: One idea for fixing this is to make cancellation keys disposable, and automatically issue a new one through the main connection when one is used, but that's not completely trivial, and requires a

Re: [HACKERS] gsoc, oprrest function for text search take 2

2008-08-13 Thread Jan Urbański
Heikki Linnakangas wrote: Jan Urbański wrote: through it. The only tiny ugliness is that there's one function used for qsort() and another for bsearch(), because I'm sorting an array of texts (from pg_statistic) and I'm binary searching for a lexeme (non-NULL terminated string with length).

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Decibel!
On Wed, Aug 13, 2008 at 07:33:40PM +0100, Andrew Gierth wrote: The following message is a courtesy copy of an article that has been posted to pgsql.hackers as well. Decibel! == Decibel! [EMAIL PROTECTED] writes: Decibel Roughly what I get on my MBP (I'm about a factor of 2 Decibel

[HACKERS] autovacuum: use case for indenpedent TOAST table autovac settings

2008-08-13 Thread Alvaro Herrera
Hackers and PG users, Does anyone see a need for having TOAST tables be individually configurable for autovacuum? I've finally come around to looking at being able to use ALTER TABLE for autovacuum settings, and I'm wondering if we need to support that case. -- Alvaro Herrera

Re: [HACKERS] gsoc, oprrest function for text search take 2

2008-08-13 Thread Heikki Linnakangas
Jan Urbański wrote: 26763 3.5451 AllocSetCheck Make sure you disable assertions before profiling. Although I'm actually a bit surprised the overhead isn't more than 3.5%, I've seen much higher overheads on other tests, but it's still skewing the results. - Heikki -- Sent via

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Gregory Stark
Decibel! [EMAIL PROTECTED] writes: Makes sense, and yeah, I was wondering a bit about that. I'll try to fake it out with offset 0 later on if no one beats me to it; I do still think we could just be seeing the effect of slogging through 200 tuples instead of going directly to the one we want.

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: That means going to the index meta page, find the fast root pointer, look up that page, look at the single leaf page pointer, look up that page, and do a binary search of the 200 leaf pointers. Once you find the resulting match, look up the heap page and

Re: [HACKERS] [PERFORM] autovacuum: use case for indenpedent TOAST table autovac settings

2008-08-13 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Does anyone see a need for having TOAST tables be individually configurable for autovacuum? I've finally come around to looking at being able to use ALTER TABLE for autovacuum settings, and I'm wondering if we need to support that case. It seems like

Re: [HACKERS] [PERFORM] autovacuum: use case for indenpedent TOAST table autovac settings

2008-08-13 Thread Alvaro Herrera
Tom Lane wrote: Alvaro Herrera [EMAIL PROTECTED] writes: Does anyone see a need for having TOAST tables be individually configurable for autovacuum? I've finally come around to looking at being able to use ALTER TABLE for autovacuum settings, and I'm wondering if we need to support that

Re: [HACKERS] [PERFORM] autovacuum: use case for indenpedent TOAST table autovac settings

2008-08-13 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Tom Lane wrote: It seems like we'll want to do it somehow. Perhaps the cleanest way is to incorporate toast-table settings in the reloptions of the parent table. Otherwise dump/reload is gonna be a mess. My question is whether there is interest in

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Decibel!
On Aug 13, 2008, at 3:52 PM, Decibel! wrote: The problem is that by looking for a constant row, you're actually eliminating the entire effect being tested, because the uncorrelated subselect is run ONCE as an initplan, and the entire query time is then spent elsewhere. The differences in runtime

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Tom Lane
Decibel! [EMAIL PROTECTED] writes: It'd be useful to get strace data on this, but OS X doesn't have that :/ (and I'm on 10.4 so no dtrace either). See ktrace. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to

Re: [HACKERS] compilig libpq with borland 5.5

2008-08-13 Thread Bruce Momjian
Uh, what version of Postgres are you testing? Would you email the output of the compile so we can see why it isn't find it? My guess is that borland CC isn't configured to find the Windows include directory. --- claudio

Re: [HACKERS] WIP: patch to create explicit support for semi and anti joins

2008-08-13 Thread David E. Wheeler
On Aug 13, 2008, at 17:31, Tom Lane wrote: What's done: Introduce JOIN_SEMI and JOIN_ANTI join types, the former replacing JOIN_IN. Unify the InClauseInfo and OuterJoinInfo infrastructure into SpecialJoinInfo. Convert IN, EXISTS, and NOT EXISTS clauses at top level of WHERE into semi and

Re: [HACKERS] WIP: patch to create explicit support for semi and anti joins

2008-08-13 Thread Tom Lane
David E. Wheeler [EMAIL PROTECTED] writes: On Aug 13, 2008, at 17:31, Tom Lane wrote: Introduce JOIN_SEMI and JOIN_ANTI join types, Wow. That sound awesome, Tom. Stupid question: Do these join types have some sort of correspondence to the SQL standard? Semi and anti joins are pretty

Re: [HACKERS] WIP: patch to create explicit support for semi and anti joins

2008-08-13 Thread David E. Wheeler
On Aug 13, 2008, at 20:12, Tom Lane wrote: Wow. That sound awesome, Tom. Stupid question: Do these join types have some sort of correspondence to the SQL standard? Semi and anti joins are pretty standard concepts in relational theory, but they have no direct mapping in the SQL join syntax.

Re: [HACKERS] SeqScan costs

2008-08-13 Thread Andrew Gierth
Decibel == Decibel! [EMAIL PROTECTED] writes: Decibel OK, ran the test again via this query: Decibel explain analyze select (select value from oneblock where id = i) Decibel from generate_series(1,1) i, generate_series(1,10) j; Decibel changing 1,1 to 200,200 as needed. I don't see

Re: [HACKERS] compilig libpq with borland 5.5

2008-08-13 Thread Merlin Moncure
On Thu, Jul 31, 2008 at 1:52 PM, claudio lezcano [EMAIL PROTECTED] wrote: Hi everybody Iam traying to build libpq.lib and libpq.dll library using Borland c++ 5.5 and i got these error: Error libpq.rc 1 11: Cannot open file: winver.h I opened the libpq.rc file and i saw the reference to

Re: [HACKERS] benchmark farm

2008-08-13 Thread Michael Holzman
On Wed, Aug 13, 2008 at 7:09 PM, Jaime Casanova wrote: any move in this? I did some changes to pgbench in February and sent them to Andrew. No reaction has been got so far. -- Regards, Michael Holzman -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to