`
qcyycom
  • 浏览: 182295 次
社区版块
存档分类
最新评论

Oracle Pipelined Table Functions

 
阅读更多

table型函数用来返回类似表结构的集合,常规的table型函数需要先填充完集合才能返回,如果集合对象太大会消耗大量内存;pipelined的table型函数能够在边填充时边返回,从而避免占用过多内存。


Table Functions

Table functions are used to return PL/SQL collections that mimic tables. They can be queried like a regular table by using the TABLE function in the FROM clause. Regular table functions require collections to be fully populated before they are returned. Since collections are held in memory, this can be a problem as large collections can waste a lot of memory and take a long time to return the first row. These potential bottlenecks make regular table functions unsuitable for large Extraction Transformation Load (ETL) operations. Regular table functions require named row and table types to be created as database objects.


Notice the above output is in reverse order because the query includes a descending order by clause.

Pipelined Table Functions

Pipelining negates the need to build huge collections by piping rows out of the function as they are created, saving memory and allowing subsequent processing to start before all the rows are generated.

Pipelined table functions include the PIPELINED clause and use the PIPE ROW call to push rows out of the function as soon as they are created, rather than building up a table collection. Notice the empty RETURN call, since there is no collection to return from the function.


Once you start working with large warehousing ETL operations the performance improvements can be massive, allowing data loads from external tables via table functions directly into the warehouse tables, rather than loading via a staging area.


FROM & MORE:

http://www.oracle-base.com/articles/misc/pipelined-table-functions.php


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics