Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Amit Langote
On Wed, Jun 10, 2015 at 8:48 PM, Rosiński Krzysztof 2 - Detal wrote: > How to use this optimization ? > > > > select * > > from table join partitioned_table on ( > > table.part_id = partitioned_table.id > > and hash_func_mod(table.part_id) = hash_func_mod(partitioned_table.id) > > ) > If I re

Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Rosiński Krzysztof 2 - Detal
How to use this optimization ? select * from table join partitioned_table on ( table.part_id = partitioned_table.id and hash_func_mod(table.part_id) = hash_func_mod(partitioned_table.id) )

Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Amit Langote
On Wed, Jun 10, 2015 at 8:33 PM, Kouhei Kaigai wrote: >> On 2015-06-10 PM 01:42, Kouhei Kaigai wrote: >> > >> > Let's assume a table which is partitioned to four portions, >> > and individual child relations have constraint by hash-value >> > of its ID field. >> > >> > tbl_parent >> >+ tbl_c

Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Kouhei Kaigai
> On 2015-06-10 PM 01:42, Kouhei Kaigai wrote: > > > > Let's assume a table which is partitioned to four portions, > > and individual child relations have constraint by hash-value > > of its ID field. > > > > tbl_parent > >+ tbl_child_0 ... CHECK(hash_func(id) % 4 = 0) > >+ tbl_child_1 ..

Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Amit Langote
On 2015-06-10 PM 05:53, Atri Sharma wrote: > On Wed, Jun 10, 2015 at 2:16 PM, Amit Langote > wrote: > >> >> Perhaps the qual needs to be pushed all the way down >> to the Hash's underlying scan if that makes sense. >> > > And that is a Pandora's box of troubles IMHO unless done in a very careful

Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Atri Sharma
On Wed, Jun 10, 2015 at 2:16 PM, Amit Langote wrote: > > Perhaps the qual needs to be pushed all the way down > to the Hash's underlying scan if that makes sense. > And that is a Pandora's box of troubles IMHO unless done in a very careful manner.

Re: [HACKERS] [idea] table partition + hash join

2015-06-10 Thread Amit Langote
On 2015-06-10 PM 01:42, Kouhei Kaigai wrote: > > Let's assume a table which is partitioned to four portions, > and individual child relations have constraint by hash-value > of its ID field. > > tbl_parent >+ tbl_child_0 ... CHECK(hash_func(id) % 4 = 0) >+ tbl_child_1 ... CHECK(hash_fun

[HACKERS] [idea] table partition + hash join

2015-06-09 Thread Kouhei Kaigai
Hello, It might be a corner case optimization, however, it looks to me worth to share the idea and have discussion. Table partition + Hash join pushdown Hash-join logic works most effectively when inner relation can be stored within a hash table. So, it is a m