Increasing working memory in psql does not improve query performance












0















I am very new to database administration and could use any advice from more expert users of PostgreSQL



My database is an AWS RDS db.m4.large whose specification are here



My queries against one of the larger tables in the database (330 million rows) are running extremely slow and/or timing out, even when I am have a query such as



SELECT(DISTINCT value) FROM mytable; 


where there are only 4 or 5 unique values in the value column. It is not indexed.



pg_size_pretty(pg_total_relation_size(relid)) shows the size of the table to be 118 GB



Even when setting work_mem to 240 MB, which should allows psql to do larger in-memory sorts, the query is equally as slow



EXPLAIN ANALYZE SELECT(DISTINCT value) FROM mytable;
also times out



What does one do to optimize memory usage for querying on a sufficiently large database? Which pg settings would I need to monitor and/or configure differently ?



Any help would be appreciated.









share



























    0















    I am very new to database administration and could use any advice from more expert users of PostgreSQL



    My database is an AWS RDS db.m4.large whose specification are here



    My queries against one of the larger tables in the database (330 million rows) are running extremely slow and/or timing out, even when I am have a query such as



    SELECT(DISTINCT value) FROM mytable; 


    where there are only 4 or 5 unique values in the value column. It is not indexed.



    pg_size_pretty(pg_total_relation_size(relid)) shows the size of the table to be 118 GB



    Even when setting work_mem to 240 MB, which should allows psql to do larger in-memory sorts, the query is equally as slow



    EXPLAIN ANALYZE SELECT(DISTINCT value) FROM mytable;
    also times out



    What does one do to optimize memory usage for querying on a sufficiently large database? Which pg settings would I need to monitor and/or configure differently ?



    Any help would be appreciated.









    share

























      0












      0








      0








      I am very new to database administration and could use any advice from more expert users of PostgreSQL



      My database is an AWS RDS db.m4.large whose specification are here



      My queries against one of the larger tables in the database (330 million rows) are running extremely slow and/or timing out, even when I am have a query such as



      SELECT(DISTINCT value) FROM mytable; 


      where there are only 4 or 5 unique values in the value column. It is not indexed.



      pg_size_pretty(pg_total_relation_size(relid)) shows the size of the table to be 118 GB



      Even when setting work_mem to 240 MB, which should allows psql to do larger in-memory sorts, the query is equally as slow



      EXPLAIN ANALYZE SELECT(DISTINCT value) FROM mytable;
      also times out



      What does one do to optimize memory usage for querying on a sufficiently large database? Which pg settings would I need to monitor and/or configure differently ?



      Any help would be appreciated.









      share














      I am very new to database administration and could use any advice from more expert users of PostgreSQL



      My database is an AWS RDS db.m4.large whose specification are here



      My queries against one of the larger tables in the database (330 million rows) are running extremely slow and/or timing out, even when I am have a query such as



      SELECT(DISTINCT value) FROM mytable; 


      where there are only 4 or 5 unique values in the value column. It is not indexed.



      pg_size_pretty(pg_total_relation_size(relid)) shows the size of the table to be 118 GB



      Even when setting work_mem to 240 MB, which should allows psql to do larger in-memory sorts, the query is equally as slow



      EXPLAIN ANALYZE SELECT(DISTINCT value) FROM mytable;
      also times out



      What does one do to optimize memory usage for querying on a sufficiently large database? Which pg settings would I need to monitor and/or configure differently ?



      Any help would be appreciated.







      postgresql psql





      share












      share










      share



      share










      asked 3 mins ago









      the_darksidethe_darkside

      12016




      12016






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "182"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232343%2fincreasing-working-memory-in-psql-does-not-improve-query-performance%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Database Administrators Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232343%2fincreasing-working-memory-in-psql-does-not-improve-query-performance%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Liste der Baudenkmale in Friedland (Mecklenburg)

          Single-Malt-Whisky

          Czorneboh