Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-06 Thread Hitoshi Harada
2008/8/6 Tom Lane [EMAIL PROTECTED]: Gregory Stark [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: There are still two places in the system that hard-wire the use of sorting for duplicate elimination: * Set operations (UNION/INTERSECT/EXCEPT) Egads. Are you thinking to

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-06 Thread Hans-Juergen Schoenig
Tom Lane wrote: I've pretty much finished the project I got a bee in my bonnet about last week, which is to teach SELECT DISTINCT how to (optionally) use hashing for grouping in the same way that GROUP BY has been able to do for awhile. There are still two places in the system that hard-wire

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-06 Thread Tom Lane
Hitoshi Harada [EMAIL PROTECTED] writes: In my patch nodeWindow.c, some functions reach for its parent state node to get info of sort keys by using fcinfo-context. This works but is completely ugly. Isn't that the same thing nodeAgg does: pass its AggState to aggregate functions? I don't see

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-06 Thread Hitoshi Harada
2008/8/6 Tom Lane [EMAIL PROTECTED]: Hitoshi Harada [EMAIL PROTECTED] writes: In my patch nodeWindow.c, some functions reach for its parent state node to get info of sort keys by using fcinfo-context. This works but is completely ugly. Isn't that the same thing nodeAgg does: pass its

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-06 Thread Tom Lane
Hitoshi Harada [EMAIL PROTECTED] writes: Correct. I learned that method from nodeAgg. What I meant was that window functions reach for plan node and its sort keys through winstate-ss.ps. The mechanism is not ugly but some macros or exposed API seem more comfortable, especially if thinking

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-06 Thread Tom Lane
I wrote: ... For INTERSECT/EXCEPT (with or without ALL), you really need to maintain counters in each hashtable entry so you know how many matching rows you got from each side of the set operation. So it'd be necessary to either duplicate a large chunk of nodeAgg.c, or make that code handle

[HACKERS] Status of DISTINCT-by-hashing work

2008-08-05 Thread Tom Lane
I've pretty much finished the project I got a bee in my bonnet about last week, which is to teach SELECT DISTINCT how to (optionally) use hashing for grouping in the same way that GROUP BY has been able to do for awhile. There are still two places in the system that hard-wire the use of sorting

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-05 Thread Asko Oja
Sounds very much like 80% 20% story. 80% that was easy to do is done and now 20% that is complex and progress is slow is left to be done. Sounds very familiar from the comment in plan cache invalidation :) On Tue, Aug 5, 2008 at 5:51 PM, Tom Lane [EMAIL PROTECTED] wrote: I've pretty much

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-05 Thread Gregory Stark
Tom Lane [EMAIL PROTECTED] writes: I've pretty much finished the project I got a bee in my bonnet about last week, which is to teach SELECT DISTINCT how to (optionally) use hashing for grouping in the same way that GROUP BY has been able to do for awhile. There are still two places in the

Re: [HACKERS] Status of DISTINCT-by-hashing work

2008-08-05 Thread Tom Lane
Gregory Stark [EMAIL PROTECTED] writes: Tom Lane [EMAIL PROTECTED] writes: There are still two places in the system that hard-wire the use of sorting for duplicate elimination: * Set operations (UNION/INTERSECT/EXCEPT) Egads. Are you thinking to reimplement them more in line with the way