On 10/2/24 02:37, Pecsök Ján wrote:
> Ok, I replaced names of tables and columns and here is the query
>
> explain (analyze, verbose, settings, format text) create table dm.v_Table6_T_111111111 with (fillfactor = 100,
parallel_workers= 20, autovacuum_enabled = false, toast.autovacuum_enabled = false) as select
> VHS.df_v_Table2_key
> , df_Table3_key
> , df_Table4
> , null::varchar as ID3Table5
> , EH.IDTable5
> , EH.ID2Table5
> from dm.v_Table1_KT as VHS
> left outer join dm.v_Table5 as EH using (df_v_Table5_key, df_Table3_key, df_Table4)
> where VHS.df_Table4 = any ('{T}')
> and VHS.df_Table4 = 'T' and VHS.df_Table3_key = 111111111;
I'm thinking it would be better to do something like:
create table dm.v_Table6_T_111111111 as select ... with no data
to create the table structure.
Then use COPY or batch INSERT to move the data into the table.
>>
>> S pozdravem
>>
>> *Ján Pecsők*
>>
>> Tychonova 2, 160 00 Praha
>> Mobil: +420 775 942 871
>> jan.pecsok@profinit.eu <mailto:jan.pecsok@profinit.eu> www.profinit.eu
>> <https://www.profinit.eu/>
>>
>> <https://www.profinit.eu/>
>>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
--
Adrian Klaver
adrian.klaver@aklaver.com