Efficient way to compute unique values using a PostgreSQL GIN indexPostgresql table with one integer column,...

UK visa start date and Flight Depature Time

How bad is a Computer Science course that doesn't teach Design Patterns?

How do I add a strong "onion flavor" to the biryani (in restaurant style)?

Are there any rules for handling distractions whilst performing skill checks?

Are all power cords made equal?

What does "don't have a baby" imply or mean in this sentence?

What happens if both players misunderstand the game state until it's too late?

Why is quixotic not Quixotic (a proper adjective)?

How can changes in personality/values of a person who turned into a vampire be explained?

How do I make my single-minded character more interested in the main story?

I am a loser when it comes to jobs, what possibilities do I have?

Do the speed limit reductions due to pollution also apply to electric cars in France?

Is it Safe to Plug an Extension Cord Into a Power Strip?

How to store all ctor parameters in fields

3D buried view in Tikz

How do I avoid the "chosen hero" feeling?

Have the UK Conservatives lost the working majority and if so, what does this mean?

Boss asked me to sign a resignation paper without a date on it along with my new contract

Why write a book when there's a movie in my head?

How can I handle players killing my NPC outside of combat?

Can I do anything else with aspersions other than cast them?

Is the tritone (A4 / d5) still banned in Roman Catholic music?

Is it common to refer to someone as "Prof. Dr. [LastName]"?

Coworker asking me to not bring cakes due to self control issue. What should I do?



Efficient way to compute unique values using a PostgreSQL GIN index


Postgresql table with one integer column, sorted index, with duplicate primary keyHow to speed up ORDER BY sorting when using GIN index in PostgreSQL?What's the point of prefixing each element in the column by its column number in multicolumn GiN indexes?How do you concatenate JSONB columns in a PostgreSQL query to produce a JSONB object?Which is more efficient for searches on JSON data in Postgres: GIN or multiple indexed columns?Defining a GIN index across two columns/arrays with similar dataAvoid adding an id-only table for a one-to-many tableIs using multiple unique constrains on a single table considered bad design?PostgreSQL most efficient way to reference multiple tablesPostgres LIKE query using a GiST index is just as slow as a full scan













0















Say I have a JSONB column, with a GIN index on it.



I can use jsonb_object_keys() to fetch the keys for each row. But is there an efficient way of getting the unique set of keys, across all rows?



Surely the GIN index must have this information already, right?



NB: I know the "classic" solution: split the single column into a many-to-many relationship.









share



























    0















    Say I have a JSONB column, with a GIN index on it.



    I can use jsonb_object_keys() to fetch the keys for each row. But is there an efficient way of getting the unique set of keys, across all rows?



    Surely the GIN index must have this information already, right?



    NB: I know the "classic" solution: split the single column into a many-to-many relationship.









    share

























      0












      0








      0








      Say I have a JSONB column, with a GIN index on it.



      I can use jsonb_object_keys() to fetch the keys for each row. But is there an efficient way of getting the unique set of keys, across all rows?



      Surely the GIN index must have this information already, right?



      NB: I know the "classic" solution: split the single column into a many-to-many relationship.









      share














      Say I have a JSONB column, with a GIN index on it.



      I can use jsonb_object_keys() to fetch the keys for each row. But is there an efficient way of getting the unique set of keys, across all rows?



      Surely the GIN index must have this information already, right?



      NB: I know the "classic" solution: split the single column into a many-to-many relationship.







      postgresql json





      share












      share










      share



      share










      asked 5 mins ago









      scribuscribu

      1085




      1085






















          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%2f230498%2fefficient-way-to-compute-unique-values-using-a-postgresql-gin-index%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%2f230498%2fefficient-way-to-compute-unique-values-using-a-postgresql-gin-index%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

          Szabolcs (Ungheria) Altri progetti | Menu di navigazione48°10′14.56″N 21°29′33.14″E /...

          Discografia di Klaus Schulze Indice Album in studio | Album dal vivo | Singoli | Antologie | Colonne...

          How to make inet_server_addr() return localhost in spite of ::1/128RETURN NEXT in Postgres FunctionConnect to...