Re: [EXTERNAL] Need help with performance tuning pg12 on linux - Mailing list pgsql-performance

From Matheus de Oliveira
Subject Re: [EXTERNAL] Need help with performance tuning pg12 on linux
Date
Msg-id CAJghg4+6h4n2TXmsWROx98DcW_gAkRTe00WvtdDEXnXi4yDP7w@mail.gmail.com
Whole thread Raw
In response to Re: [EXTERNAL] Need help with performance tuning pg12 on linux  ("Wilson, Maria Louise (LARC-E301)[RSES]" <m.l.wilson@nasa.gov>)
List pgsql-performance


On Wed, Dec 27, 2023 at 2:11 PM Wilson, Maria Louise (LARC-E301)[RSES] <m.l.wilson@nasa.gov> wrote:

Thanks for the reply!!  Having some issues due to nulls….  Any other thoughts?

 

i=# ALTER TABLE granule_file ADD PRIMARY KEY (granule_uuid, file_id);

ERROR:  column "granule_uuid" contains null values

 


Seems like an odd design for your table. Check if those rows with null value make any sense for your design.

In any case, for performance, you can try a plain index:

    CREATE INDEX ON granule_file (granule_uuid);

Since you are filtering for granule_uuid first, an index starting with this column seems to make more sense (that is why I made the PK starting with it before).

A composite index is not really necessary, but could help if you get an index-only scan, if you wanna try:

    CREATE INDEX ON granule_file (granule_uuid, file_id);

Best regards,
--
Matheus de Oliveira


pgsql-performance by date:

Previous
From: "Wilson, Maria Louise (LARC-E301)[RSES]"
Date:
Subject: Re: [EXTERNAL] Need help with performance tuning pg12 on linux
Next
From: Matheus de Oliveira
Date:
Subject: Re: [EXTERNAL] Need help with performance tuning pg12 on linux