From: | Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Array vs Temporary table vs Normal Table + truncate at end |
Date: | 2023-09-04 16:42:19 |
Message-ID: | CAJMpnG7QakV4-XRggcjB289W0=C+jV8HNcrQXzzhPFDK7H=ADA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello guys,
I prepared a function that build a set of records of type (myComplexType).
That works, but I've to use this record set in different situations.
One of them require to scan multiple times the function results:
1. comparing with another table (myProducteAttributeTable) to determine
if I need to delete old record
2. check if the recordset contains attribute never registered before
3. in this case insert in appropriate table (myAttribute), retrieve
attribute uid and type
4. finally update first table (myProducteAttributeTable) with new
information coming from the recordset (with a merge)
So, which is the best approach?
- Store result in an array and use in each subsequent query the unnest
(with a complex record type?)
- Create temporary table on commit delete, with the same structure? But
in this case I can't declare a cursor for the table, and I can't use update
where current of (for point 3)
- Create normal table and truncate as part of execution, but what
happens in case of parallel execution?
From | Date | Subject | |
---|---|---|---|
Next Message | Erik Wienhold | 2023-09-04 22:03:53 | Re: createuser unexpectedly creates superuser with createdb and createrole |
Previous Message | Erik Wienhold | 2023-09-04 15:22:23 | Re: rollback to savepoint issue |