Skip to content

Implement a server-side cursor to improve performance when fetching large volumes of data. #5797#8837

Merged
akshay-joshi merged 12 commits into
pgadmin-org:masterfrom
khushboovashi:master
Jul 2, 2025
Merged

Implement a server-side cursor to improve performance when fetching large volumes of data. #5797#8837
akshay-joshi merged 12 commits into
pgadmin-org:masterfrom
khushboovashi:master

Conversation

@khushboovashi

Copy link
Copy Markdown
Contributor

No description provided.

@akshay-joshi akshay-joshi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GUI-related comments:

  1. Select 'Use server cursor' from the query tool. Run "select 1" query. Clicking on the Commit button gets the error message " the cursor is closed" and on Rollback "DECLARE "CURSOR:CONN:961921" CURSOR FOR ROLLBACK;" Disable those buttons in server cursor mode.
  2. Set "Execute with server side cursor?" To true. Select any table and click on View/Edit data. It executes the query, but again commit and rollback buttons get enabled. Now try following:
  • Try to close the tab. It will not.
  • Pagination shows Page no 1 of 0.
  • Click on Next page or Previous page, nothing happens, and the data is lost.    

Code-related comments:

  1. Add this new 'Use server cursor?" preference to the preferences.rst. The screenshot will be updated after Aditya's PR.
  2. Fix 3 small code smells in sqleditor/init.py

Comment thread docs/en_US/images/query_tool_server_cursor_preference.png Outdated
Comment thread docs/en_US/query_tool.rst Outdated
Comment thread docs/en_US/query_tool.rst Outdated
Comment thread docs/en_US/query_tool.rst Outdated
Comment thread web/pgadmin/tools/sqleditor/__init__.py
Comment thread web/pgadmin/utils/driver/psycopg3/connection.py Outdated
Comment thread web/pgadmin/utils/driver/psycopg3/connection.py Outdated
Comment thread web/pgadmin/utils/driver/psycopg3/connection.py
Comment thread web/pgadmin/utils/driver/psycopg3/cursor.py Outdated
Comment thread web/pgadmin/utils/driver/psycopg3/cursor.py Outdated
@khushboovashi

Copy link
Copy Markdown
Contributor Author

GUI-related comments:

  1. Select 'Use server cursor' from the query tool. Run "select 1" query. Clicking on the Commit button gets the error message " the cursor is closed" and on Rollback "DECLARE "CURSOR:CONN:961921" CURSOR FOR ROLLBACK;" Disable those buttons in server cursor mode.

Fixed the issue. I have disabled the buttons right now in View/Edit data but that is debatable, we will discuss that in the review.

  1. Set "Execute with server side cursor?" To true. Select any table and click on View/Edit data. It executes the query, but again commit and rollback buttons get enabled. Now try following:
  • Try to close the tab. It will not.
    Fixed
  • Pagination shows Page no 1 of 0.
    Fixed
  • Click on Next page or Previous page, nothing happens, and the data is lost.
    Didn't reproduce

Code-related comments:

  1. Add this new 'Use server cursor?" preference to the preferences.rst. The screenshot will be updated after Aditya's PR.
    Fixed
  2. Fix 3 small code smells in sqleditor/init.py

@akshay-joshi akshay-joshi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the preferences screenshot.

Comment thread web/pgadmin/tools/sqleditor/tests/test_server_cursor.py Outdated
Comment thread docs/en_US/images/query_tool_server_cursor_execute_menu.png
Comment thread web/pgadmin/tools/sqleditor/static/js/components/sections/MainToolBar.jsx Outdated
@akshay-joshi akshay-joshi merged commit f207818 into pgadmin-org:master Jul 2, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants