Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > Re: introductio...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 11 Topic 9634 of 10118
Post > Topic >>

Re: introduction of WIP window function patch

by simon@[EMAIL PROTECTED] (Simon Riggs) Jul 6, 2008 at 10:22 AM

On Sun, 2008-07-06 at 17:39 +0900, H.Harada wrote:

> Is there security/performance issue about this?

Performance, yes. 

If we need access to more rows than will fit within work_mem we have a
problem and will need to restart sort. Giving random access to all
tuples in the current window, whatever its size would be very costly,
which is why we have optimized that access for merge joins. So we need
to know how far back access is required, if any - think of that as an
"access window" definition.

For example, 
rownumber() doesn't need access to prior tuples at all.
lag(col, 1) requires access only to the prior row of the current window
ntile() needs to know the size of the window before we begin processing 

In some cases the window itself is redefined for each tuple, e.g. 
avg() over (order by ... range between 5 preceeding and current row) 

In that case, we want the tuples no longer in the window to scroll out
of memory. We already have the mechanism for this: a dynamic tuplestore
(materialize node) in front of the tuplesort (sort node).

Most of that tuning can be done after the initial implementation, but my
point here is this: there needs to be a mechanism by which the window
access requirements can be specified for a function so the executor can
understand how to optimise access. So if you go the route of defining an
extensible API then you must include this also.

I know I rattle on about performance, but with window functions it will
be critical to their usability to have them perform well. We can already
do the types of analysis that window functions allow, it just requires
hand written procedures to do it. So the window functions must perform
acceptably well against very large tables (i.e. much bigger than
memory).

-- 
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Sup****t


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 11 Posts in Topic:
introduction of WIP window function patch
umi.tanuki@[EMAIL PROTECT  2008-07-05 19:04:29 
Re: introduction of WIP window function patch
kleptog@[EMAIL PROTECTED]  2008-07-05 16:20:24 
Re: introduction of WIP window function patch
simon@[EMAIL PROTECTED]   2008-07-05 18:21:13 
Re: introduction of WIP window function patch
umi.tanuki@[EMAIL PROTECT  2008-07-06 03:40:48 
Re: introduction of WIP window function patch
umi.tanuki@[EMAIL PROTECT  2008-07-06 03:46:58 
Re: introduction of WIP window function patch
simon@[EMAIL PROTECTED]   2008-07-05 21:12:33 
Re: introduction of WIP window function patch
umi.tanuki@[EMAIL PROTECT  2008-07-06 17:39:11 
Re: introduction of WIP window function patch
simon@[EMAIL PROTECTED]   2008-07-06 10:22:11 
Re: introduction of WIP window function patch
umi.tanuki@[EMAIL PROTECT  2008-07-06 19:15:02 
Re: introduction of WIP window function patch
david@[EMAIL PROTECTED]   2008-07-17 00:28:59 
Re: introduction of WIP window function patch
umi.tanuki@[EMAIL PROTECT  2008-07-17 18:20:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Sep 7 6:56:13 CDT 2008.