Search Postgresql Archives

About index for temporay table in a plpgsql function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

A question about index for temporary table.

Postgresql 8.0.1, in a pl/pgsql function:
begin
...
-- Part I
create temporal table t1 as ((select ... from .. left join ..... where ... ) union (select .. from ... left join ... where ... ));
create index idx_t1_cols on t1(col1, col2) tablespace ts1;

...
-- Part II
insert into tableX
(
 select ...
 from tableY
 left join t1 using (col1, col2)
 where ... ...
)
...
end;

In the above example, the index for t1 can speed up the left join query in part II (although, there is no analyze done after the creation of index), right?

The temporary table will be dropped automatically at the end of the function, right? By the way, is there anythings need to pay especially attention about temporary table under a function please?

Thanks a lot,
Ying




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux