select
"view"."unit" as "c0"
from (
select "tabl"."c1", "tabl"."c2", "tabl"."c3", "tabl"."id", "multi_c3"."unit" as "unit"
from
"tabl" as "tabl"
left join
"multi_c3" as "multi_c3"
on
"tabl"."c3" = "multi_c3"."id") as "view"
group by "view"."unit"
having NOT((count("view"."id") is null))
order by CASE WHEN "view"."unit" IS NULL THEN 1 ELSE 0 END, "view"."unit" ASC
Nothing too fancy. The tables might have several million rows each.
While executing this type of query i often get the exception:
com.vertica.util.ServerException: [Vertica][VJDBC](3814) ERROR: Join inner did not fit in memory
This is somehow expected since the hardware might not be the best to support the amount of data, still that is another problem.
While googling I've found reference to an option that enables the join to be spilled into disk if required, but i failed to find any mention to it on the documentation (https://my.vertica.com/docs/7.0.x/HTML/index.htm).
Looking at https://community.vertica.com/vertica/topics/enable_join_spill and https://community.vertica.com/vertica/topics/join_inner_did_not_fit_in_memory I've tryed to test this option to evaluate if it would solve the problem or if it would do more harm than good. Unfortunately I haven't been able to use it, it seems like it does nothing.
I'm running the query over a jdbc connection and i've tried to set the property on the database permanently with:
SELECT set_config_parameter('EEVerticaOptions','ENABLE_JOIN_SPILL')
And running it within the same statement as the sql query above like:select add_vertica_options('EE', 'ENABLE_JOIN_SPILL');
select
"view"."unit" as "c0"
from (
select "tabl"."c1", "tabl"."c2", "tabl"."c3", "tabl"."id", "multi_c3"."unit" as "unit"
from
"tabl" as "tabl"
left join
"multi_c3" as "multi_c3"
on
"tabl"."c3" = "multi_c3"."id") as "view"
group by "view"."unit"
having NOT((count("view"."id") is null))
order by CASE WHEN "view"."unit" IS NULL THEN 1 ELSE 0 END, "view"."unit" ASC
But the error remains and the option seems to have no effect. Any idea what i'm doing wrong?