Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throws ERROR when statement_mem is set to greater than max_statement_mem #15087

Merged
merged 1 commit into from Mar 6, 2023

Conversation

fairyfar
Copy link
Contributor

@fairyfar fairyfar commented Mar 1, 2023

Summary

The GPDB's document says that:

statement_mem
Sets the maximum memory limit for a query. Helps avoid out-of-memory errors on a segment host during query processing as a result of setting statement_mem too high.

However, there is no any ERROR when I set statement_mem to greater than max_statement_mem.
So, max_statement_mem loses protection for statement_mem.

Test Case

postgres=# select version();
                                                                                                       version
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 PostgreSQL 12.12 (Greenplum Database 7.0.0-beta.1+dev.90.g7ac8734891 build dev) on x86_64-pc-linux-gnu, compiled by gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2), 64-bit compiled on Feb 17 2023 10:00:04 Bhuvnesh C.
(1 row)

postgres=# show max_statement_mem;
 max_statement_mem
-------------------
 2000MB
(1 row)

postgres=# show statement_mem;
 statement_mem
---------------
 125MB
(1 row)

-- Set statement_mem > max_statement_mem,
-- but no ERROR reported.
postgres=# set statement_mem = '4000MB';
SET
postgres=# show statement_mem;
 statement_mem
---------------
 4000MB
(1 row)

-- The 'Memory used' of query is 4000MB(4096000kB)
postgres=# explain analyze select 1;
                                     QUERY PLAN
------------------------------------------------------------------------------------
 Result  (cost=0.00..0.00 rows=1 width=1) (actual time=0.002..0.002 rows=1 loops=1)
 Optimizer: Pivotal Optimizer (GPORCA)
 Planning Time: 1.447 ms
   (slice0)    Executor memory: 4K bytes.
 Memory used:  4096000kB
 Execution Time: 0.034 ms
(6 rows)

Here are some reminders before you submit the pull request

  • Add tests for the change
  • Document changes
  • Communicate in the mailing list if needed
  • Pass make installcheck
  • Review a PR in return to support the community

Copy link
Contributor

@SmartKeyerror SmartKeyerror left a comment

Choose a reason for hiding this comment

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

LTGM. Thanks for your contribution!

@kainwen kainwen merged commit 301c9a2 into greenplum-db:main Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community PR from outside VMware version: 7X_ALPHA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants