Re: [HACKERS] An idle thought

2010-03-22 Thread Bruce Momjian
Jeff Davis wrote: On Tue, 2010-03-16 at 15:29 +, Greg Stark wrote: I'm picturing storing a bit in the visibility map indicating that *no* records are visible in a given page. I've been thinking for a while that we could store the visibility information in a structure separate from the

Re: [HACKERS] An idle thought

2010-03-22 Thread Jeff Davis
On Mon, 2010-03-22 at 16:48 -0400, Bruce Momjian wrote: I don't think we want to move to 64-bit xids becasue we would still need to do vacuum freeze to trim the clog. In fact we do vacuum freeze much more frequently than required for 32-bit xids for this very reason. Good point. I think there

Re: [HACKERS] An idle thought

2010-03-19 Thread Gokulakannan Somasundaram
Surely the VM is already update-friendly. If you update a tuple in a page with the visibility bit set, the bit must be unset or you will get wrong results. I was referring in the context of index only scans to skip visibility checks. I doubt, whether the visibility map feature to skip

Re: [HACKERS] An idle thought

2010-03-18 Thread Gokulakannan Somasundaram
On Thu, Mar 18, 2010 at 2:50 AM, Tom Lane t...@sss.pgh.pa.us wrote: Jeff Davis pg...@j-davis.com writes: There are all kinds of challenges there, but it might be worth thinking about. Visibility information is highly compressible, and requires constant maintenance (updates, deletes,

Re: [HACKERS] An idle thought

2010-03-18 Thread Gokulakannan Somasundaram
Secondly there's the whole retail vacuum problem -- any index entries referring to this page would be left dangling unless there's some kind of retail vacuum or perhaps a page version number. The issue, we can divide into two a)volatile functions b)broken datatypes For a) I think volatile

Re: [HACKERS] An idle thought

2010-03-18 Thread Gokulakannan Somasundaram
I didn't mean that we'd want to compress it to the absolute minimum size. I had envisioned that it would be a simple scheme designed only to eliminate long runs of identical visibility information (perhaps only the frozen and always visible regions would be compressed). The extra level of

Re: [HACKERS] An idle thought

2010-03-18 Thread Chris Browne
si...@2ndquadrant.com (Simon Riggs) writes: On Tue, 2010-03-16 at 15:29 +, Greg Stark wrote: big batch delete Is one of the reasons for partitioning, allowing the use of truncate. Sure, but it would be even nicer if DELETE could be thus made cheaper without needing to interfere with the

Re: [HACKERS] An idle thought

2010-03-18 Thread Jeff Davis
On Thu, 2010-03-18 at 14:29 +0530, Gokulakannan Somasundaram wrote: If you want it to be cheaply updatable (or even cheaply readable), compression is not what you're going to do. regards, tom lane

Re: [HACKERS] An idle thought

2010-03-18 Thread Gokulakannan Somasundaram
The visibility map itself is already an example of compression. If visibility information were randomly distributed among tuples, the visibility map would be nearly useless. I believe it is very difficult to make visibility map update friendly without compromising durability. But such a

Re: [HACKERS] An idle thought

2010-03-18 Thread Jeff Davis
On Fri, 2010-03-19 at 01:59 +0530, Gokulakannan Somasundaram wrote: The visibility map itself is already an example of compression. If visibility information were randomly distributed among tuples, the visibility map would be nearly useless.

Re: [HACKERS] An idle thought

2010-03-18 Thread Tom Lane
Jeff Davis pg...@j-davis.com writes: On Fri, 2010-03-19 at 01:59 +0530, Gokulakannan Somasundaram wrote: I believe it is very difficult to make visibility map update friendly without compromising durability. But such a functionality is very much wanted in PG still. Surely the VM is already

Re: [HACKERS] An idle thought

2010-03-18 Thread Jeff Davis
On Thu, 2010-03-18 at 16:50 -0400, Tom Lane wrote: The VM is (a) not compressed and (b) not correctness-critical. Wrong bit values don't do any serious damage. The VM cause wrong results if a bit is set that's not supposed to be -- right? Am I missing something? How does a seq scan skip

Re: [HACKERS] An idle thought

2010-03-18 Thread Alex Hunsaker
On Thu, Mar 18, 2010 at 15:07, Jeff Davis pg...@j-davis.com wrote: On Thu, 2010-03-18 at 16:50 -0400, Tom Lane wrote: The VM is (a) not compressed and (b) not correctness-critical. Wrong bit values don't do any serious damage. The VM cause wrong results if a bit is set that's not supposed to

Re: [HACKERS] An idle thought

2010-03-18 Thread Tom Lane
Jeff Davis pg...@j-davis.com writes: On Thu, 2010-03-18 at 16:50 -0400, Tom Lane wrote: The VM is (a) not compressed and (b) not correctness-critical. Wrong bit values don't do any serious damage. The VM cause wrong results if a bit is set that's not supposed to be -- right? Am I missing

Re: [HACKERS] An idle thought

2010-03-18 Thread Greg Stark
On Thu, Mar 18, 2010 at 9:07 PM, Jeff Davis pg...@j-davis.com wrote: The VM cause wrong results if a bit is set that's not supposed to be -- right? Am I missing something? How does a seq scan skip visibility checks and still produce right results, if it doesn't rely on the bit? There's also a

Re: [HACKERS] An idle thought

2010-03-18 Thread Jeff Davis
On Thu, 2010-03-18 at 17:17 -0400, Tom Lane wrote: The VM cause wrong results if a bit is set that's not supposed to be -- right? Am I missing something? How does a seq scan skip visibility checks and still produce right results, if it doesn't rely on the bit? It doesn't. The only thing

Re: [HACKERS] An idle thought

2010-03-18 Thread Jeff Davis
On Thu, 2010-03-18 at 14:48 -0700, Jeff Davis wrote: On Thu, 2010-03-18 at 17:17 -0400, Tom Lane wrote: The VM cause wrong results if a bit is set that's not supposed to be -- right? Am I missing something? How does a seq scan skip visibility checks and still produce right results, if it

Re: [HACKERS] An idle thought

2010-03-18 Thread Tom Lane
Jeff Davis pg...@j-davis.com writes: I tested in gdb, and it calls HeapTupleSatisfiesMVCC, until I VACUUM a few times, and then it doesn't call it any more. So, apparently the seq scan optimization _is_ there. And that means it is correctness-critical. The page header bit is critical. Not the

Re: [HACKERS] An idle thought

2010-03-17 Thread Simon Riggs
On Tue, 2010-03-16 at 15:29 +, Greg Stark wrote: big batch delete Is one of the reasons for partitioning, allowing the use of truncate. -- Simon Riggs www.2ndQuadrant.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] An idle thought

2010-03-17 Thread Jeff Davis
On Tue, 2010-03-16 at 15:29 +, Greg Stark wrote: I'm picturing storing a bit in the visibility map indicating that *no* records are visible in a given page. I've been thinking for a while that we could store the visibility information in a structure separate from the heap -- sort of like

Re: [HACKERS] An idle thought

2010-03-17 Thread Tom Lane
Jeff Davis pg...@j-davis.com writes: There are all kinds of challenges there, but it might be worth thinking about. Visibility information is highly compressible, and requires constant maintenance (updates, deletes, freezing, etc.). It also might make it possible to move to 64-bit xids, if we

Re: [HACKERS] An idle thought

2010-03-17 Thread Jeff Davis
On Wed, 2010-03-17 at 17:20 -0400, Tom Lane wrote: Jeff Davis pg...@j-davis.com writes: There are all kinds of challenges there, but it might be worth thinking about. Visibility information is highly compressible, and requires constant maintenance (updates, deletes, freezing, etc.). It also

Re: [HACKERS] An idle thought

2010-03-17 Thread Simon Riggs
On Wed, 2010-03-17 at 14:09 -0700, Jeff Davis wrote: I've been thinking for a while that we could store the visibility information in a structure separate from the heap -- sort of like the visibility map, but per-tuple and authoritative rather than a per-page hint. A lot of people have been

Re: [HACKERS] An idle thought

2010-03-16 Thread Tom Lane
Greg Stark st...@mit.edu writes: However then I started thinking about this case and wondered if it wouldn't be possible to optimize. One of the suggested optimizations was to look at using TRUNCATE. But I wonder why it's necessary to use a dedicated command. Shouldn't it be possible for the