Increase heap size for sqlworkbench/J in Ubuntu

432 views Asked by At

I tried running an SQL query on my SQLworkbench on my Ubuntu OS

SELECT *,d.dept_name,
 MAX(salary)
OVER(
  PARTITION BY d.dept_name
  ) AS "SAL"
FROM salaries
JOIN dept_emp AS de USING(emp_no)
JOIN departments AS d USING(dept_no)

It was running when I suddenly got a pop up message sql workbench the system is running low on memory. to prevent data corruption the current operation has been aborted. please increase the heap size with the -xmx parameter.

I went through some similar post on Stackoverflow and I found this one Increase heap size for sqlworkbench/J

It mentioned running a command java -Xmx4g -jar sqlworkbench.jar which I did but when I do that it runs a completely new instance of my Workbench as if I am freshly installing it. Please help I will be doing a lot of PARTITION BY queries but I am hindered by this issue.. I checked the free memory and it is 1924MB/1966MB.

Also when the above pop-up message shows, besides my memory usage spiking up whilst running the query before finally giving that pop-up message... the query timer still keeps counting and my memory usage is as it is as if the query is running, and the option to cancel execution is not available, unless I finally close the SQLworkbench then my system memory usage comes back to normal.

Please help I have an 64bit system with 8GB RAM

SQLworkbench folder files

MEMORY SIZE INFORMATION FOR SQLWORKBENCH

1

There are 1 answers

3
AudioBubble On

The relevant part of sqlworkbench.sh are these lines:

exec "$JAVACMD"  $OPTS \
                -Dawt.useSystemAAFontSettings=on \
                -Xverify:none \
                -Dvisualvm.display.name=SQLWorkbenchJ -cp "$cp" workbench.WbStarter "$@"

Just add the -Xmx paramter where you want, e.g:

exec "$JAVACMD"  $OPTS \
                -Dawt.useSystemAAFontSettings=on \
                -Xverify:none \
                -Xmx4g \
                -Dvisualvm.display.name=SQLWorkbenchJ -cp "$cp" workbench.WbStarter "$@"