Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions web/pgadmin/tools/sqleditor/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,14 @@ def __init__(self, **kwargs):

if self.cmd_type in (VIEW_FIRST_100_ROWS, VIEW_LAST_100_ROWS):
self.limit = 100
elif self.cmd_type == VIEW_ALL_ROWS:
# Apply the user-configurable default row limit (if any) for the
# "All Rows" option. A value of 0 (the default) means no limit,
# preserving the existing behaviour of fetching all rows.
default_row_limit = Preferences.module('sqleditor').preference(
'view_data_default_row_limit').get()
if default_row_limit and default_row_limit > 0:
self.limit = default_row_limit

self.thread_native_id = None
self.server_cursor = kwargs['server_cursor'] if\
Expand Down
15 changes: 15 additions & 0 deletions web/pgadmin/tools/sqleditor/utils/query_tool_preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,21 @@ def register_query_tool_preferences(self):
"First/Last 100 Rows options, data is always sorted.")
)

self.view_data_default_row_limit = self.preference.register(
'Options', 'view_data_default_row_limit',
gettext("Default row limit for View Data"), 'integer', 0,
min_val=0,
category_label=PREF_LABEL_OPTIONS,
help_str=gettext(
"Specify the maximum number of rows to fetch when using the "
"View/Edit Data - All Rows option. This appends a LIMIT clause "
"to the generated query, which can significantly improve "
"performance on very large tables. Set to 0 (the default) to "
"fetch all rows with no limit (the existing behavior). This "
"does not affect the First/Last 100 Rows options."
)
)

self.show_prompt_save_data_changes = self.preference.register(
'Options', 'prompt_save_data_changes',
gettext("Prompt to save unsaved data changes?"), 'boolean', True,
Expand Down
Loading