Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabling nested loop join and disabling hash join in postgres.

Tags:

postgresql

I want to disable the hashjoin algorithm used by postgres by default, and enable the nested loop join algorithm, can some one tell me how to do that.

I tried modifying the postgresql.conf file where I set the value enable_hashjoin=off and also enable_mergejoin=off, so that I could force postgres to use nested loop. but postgres is still using the hash join algorithm even after modifying the postgresql.conf file.

I did try the pg_ctl reload command to reload the configuration files, but its still using the hash join algorithm and not the nested loop algorithm. I even restarted the server, even then its still using the hash join algorithm

can some one tell me what I am doing wrong, or is there any other file where I need to modify to force postgres to use nested loop algorithm.

PS: I already posted this question in pg_hackers mailing list,but I have not got any answer there yet, so I am posting here.

Thanks

like image 423
megamind Avatar asked Aug 16 '26 23:08

megamind


1 Answers

I achieved this in PHP code while using Postgres as below:

$db = pg_connect("host=".DBHost." port=".DBPORT." user=".DBUserName." password=".DBPassword." dbname=".DBName);

pg_query($db, "set enable_hashjoin=off");
pg_query($db, "set enable_mergejoin=off");
like image 144
MarioFruzan Avatar answered Aug 18 '26 17:08

MarioFruzan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!