Unix Technical Forum

pgsql: Revise handling of dropped columns in JOIN alias lists to avoid a

This is a discussion on pgsql: Revise handling of dropped columns in JOIN alias lists to avoid a within the pgsql Committers forums, part of the PostgreSQL category; --> Log Message: ----------- Revise handling of dropped columns in JOIN alias lists to avoid a performance problem pointed out ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Committers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 12:04 PM
Tom Lane
 
Posts: n/a
Default pgsql: Revise handling of dropped columns in JOIN alias lists to avoid a

Log Message:
-----------
Revise handling of dropped columns in JOIN alias lists to avoid a
performance problem pointed out by phil@vodafone: to wit, we were
spending O(N^2) time to check dropped-ness in an N-deep join tree,
even in the case where the tree was freshly constructed and couldn't
possibly mention any dropped columns. Instead of recursing in
get_rte_attribute_is_dropped(), change the data structure definition:
the joinaliasvars list of a JOIN RTE must have a NULL Const instead
of a Var at any position that references a now-dropped column. This
costs nothing during normal parse-rewrite-plan path, and instead we
have a linear-time update to make when loading a stored rule that
might contain now-dropped columns. While at it, move the responsibility
for acquring locks on relations referenced by rules into this separate
function (which I therefore chose to call AcquireRewriteLocks).
This saves effort --- namely, duplicated lock grabs in parser and rewriter
--- in the normal path at a cost of one extra non-locked heap_open()
in the stored-rule path; seems a good tradeoff. A fringe benefit is
that it is now *much* clearer that we acquire lock on relations referenced
in rules before we make any rewriter decisions based on their properties.
(I don't know of any bug of that ilk, but it wasn't exactly clear before.)

Modified Files:
--------------
pgsql/src/backend/commands:
explain.c (r1.135 -> r1.136)
(http://developer.postgresql.org/cvsw...1.135&r2=1.136)
portalcmds.c (r1.41 -> r1.42)
(http://developer.postgresql.org/cvsw...1=1.41&r2=1.42)
prepare.c (r1.38 -> r1.39)
(http://developer.postgresql.org/cvsw...1=1.38&r2=1.39)
pgsql/src/backend/optimizer/util:
var.c (r1.63 -> r1.64)
(http://developer.postgresql.org/cvsw...1=1.63&r2=1.64)
pgsql/src/backend/parser:
parse_relation.c (r1.108 -> r1.109)
(http://developer.postgresql.org/cvsw...1.108&r2=1.109)
pgsql/src/backend/rewrite:
rewriteHandler.c (r1.152 -> r1.153)
(http://developer.postgresql.org/cvsw...1.152&r2=1.153)
pgsql/src/backend/tcop:
postgres.c (r1.446 -> r1.447)
(http://developer.postgresql.org/cvsw...1.446&r2=1.447)
pgsql/src/backend/utils/adt:
ruleutils.c (r1.198 -> r1.199)
(http://developer.postgresql.org/cvsw...1.198&r2=1.199)
pgsql/src/include/nodes:
parsenodes.h (r1.278 -> r1.279)
(http://developer.postgresql.org/cvsw...1.278&r2=1.279)
pgsql/src/include/parser:
parsetree.h (r1.29 -> r1.30)
(http://developer.postgresql.org/cvsw...1=1.29&r2=1.30)
pgsql/src/include/rewrite:
rewriteHandler.h (r1.24 -> r1.25)
(http://developer.postgresql.org/cvsw...1=1.24&r2=1.25)
pgsql/src/include/tcop:
tcopprot.h (r1.74 -> r1.75)
(http://developer.postgresql.org/cvsw...1=1.74&r2=1.75)

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:55 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com