query optimizer

Started by jungmin shinalmost 19 years ago12 messagesgeneral
Jump to latest
#1jungmin shin
jungmin.shin@gmail.com

Hello,

As I see the documentation of postgres, postgres use genetic algorithm for
query optimization rather than system R optimizer. right?

--
Jungmin Shin

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: jungmin shin (#1)
Re: query optimizer

"jungmin shin" <jungmin.shin@gmail.com> writes:

As I see the documentation of postgres, postgres use genetic algorithm for
query optimization rather than system R optimizer. right?

Only for queries with more than geqo_threshold relations. The join
search algorithm for smaller queries is a System-R-like dynamic
programming method.

regards, tom lane

#3Luca Ferrari
fluca1978@infinito.it
In reply to: Tom Lane (#2)
Re: query optimizer

On Tuesday 17 April 2007 Tom Lane's cat, walking on the keyboard, wrote:

"jungmin shin" <jungmin.shin@gmail.com> writes:

As I see the documentation of postgres, postgres use genetic algorithm
for query optimization rather than system R optimizer. right?

Only for queries with more than geqo_threshold relations. The join
search algorithm for smaller queries is a System-R-like dynamic
programming method.

Hi,
I'd like to better understand how the optimizer works and is implemented. Is
there any available documentation (before start reading the source!) to
understand concepts about geqo and system r? Any chance about any demo or
presentation with detailed examples (about how the optimizer makes and
discards choices, not about how to read the planner output)?

Thanks,
Luca

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Luca Ferrari (#3)
Re: query optimizer

Luca Ferrari <fluca1978@infinito.it> writes:

I'd like to better understand how the optimizer works and is implemented. Is
there any available documentation (before start reading the source!) to
understand concepts about geqo and system r? Any chance about any demo or
presentation with detailed examples (about how the optimizer makes and
discards choices, not about how to read the planner output)?

http://developer.postgresql.org/pgdocs/postgres/overview.html
(particularly 42.5)

src/backend/optimizer/README

The developers section of the website used to have slides from a couple
of talks I gave at OSCON, but I don't see them there anymore :-(

regards, tom lane

#5Greg Smith
gsmith@gregsmith.com
In reply to: Tom Lane (#4)
Re: query optimizer

On Thu, 19 Jul 2007, Tom Lane wrote:

The developers section of the website used to have slides from a couple
of talks I gave at OSCON, but I don't see them there anymore :-(

This one is still around:
http://conferences.oreillynet.com/presentations/os2003/lane_tom.pdf

I'd also recommend http://www.gtsm.com/oscon2003/toc.html on this topic.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD

#6Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#4)
Re: query optimizer

On Thu, Jul 19, 2007 at 10:41:03AM -0400, Tom Lane wrote:

Luca Ferrari <fluca1978@infinito.it> writes:

I'd like to better understand how the optimizer works and is implemented. Is
there any available documentation (before start reading the source!) to
understand concepts about geqo and system r? Any chance about any demo or
presentation with detailed examples (about how the optimizer makes and
discards choices, not about how to read the planner output)?

http://developer.postgresql.org/pgdocs/postgres/overview.html
(particularly 42.5)

src/backend/optimizer/README

The developers section of the website used to have slides from a couple
of talks I gave at OSCON, but I don't see them there anymore :-(

How long ago was this (that they were on the website)? I don't recall that
ever being removed, and I can't find it in the cvs either.

If you still have the presentations, we can always add them back in... (I
recall reading them, but don't have a local copy)

//Magnus

#7Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#6)
Re: query optimizer

Magnus Hagander <magnus@hagander.net> writes:

On Thu, Jul 19, 2007 at 10:41:03AM -0400, Tom Lane wrote:

The developers section of the website used to have slides from a couple
of talks I gave at OSCON, but I don't see them there anymore :-(

How long ago was this (that they were on the website)? I don't recall that
ever being removed, and I can't find it in the cvs either.

Hmm, I thought they were once on the same page as Bruce's papers, now
http://www.postgresql.org/developer/coding
but possibly I'm mistaken; it was well before the website reorg anyway.

If you still have the presentations, we can always add them back in... (I
recall reading them, but don't have a local copy)

Yeah, the PDFs are still in my home directory on cvs.postgresql.org.

regards, tom lane

#8Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Magnus Hagander (#6)
Re: query optimizer

Magnus Hagander wrote:

On Thu, Jul 19, 2007 at 10:41:03AM -0400, Tom Lane wrote:

The developers section of the website used to have slides from a couple
of talks I gave at OSCON, but I don't see them there anymore :-(

How long ago was this (that they were on the website)? I don't recall that
ever being removed, and I can't find it in the cvs either.

If you still have the presentations, we can always add them back in... (I
recall reading them, but don't have a local copy)

Last time I asked, I found them in Tom's home dir in cvs.postgresql.org.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#9Luca Ferrari
fluca1978@infinito.it
In reply to: Tom Lane (#4)
Re: query optimizer

On Thursday 19 July 2007 Tom Lane's cat, walking on the keyboard, wrote:

http://developer.postgresql.org/pgdocs/postgres/overview.html
(particularly 42.5)

I have already read this, thanks.

src/backend/optimizer/README

I've read this yesterday, very interesting, but I'm looking for something
similar related to geqo. I mean, is there any presentation/demo that
step-y-step explains how geqo could take decisions?

Thanks,
Luca

#10Tom Lane
tgl@sss.pgh.pa.us
In reply to: Luca Ferrari (#9)
Re: query optimizer

Luca Ferrari <fluca1978@infinito.it> writes:

src/backend/optimizer/README

I've read this yesterday, very interesting, but I'm looking for something
similar related to geqo. I mean, is there any presentation/demo that
step-y-step explains how geqo could take decisions?

There's not a lot, but I just made a few improvements here and here:
http://developer.postgresql.org/pgdocs/postgres/planner-optimizer.html
http://developer.postgresql.org/pgdocs/postgres/geqo-pg-intro.html

Beyond that, the GEQO chapter provides several references, and IMHO
you should not be all that resistant to looking into the source code.
Even if you don't read C well, many of the files provide a wealth of
info in the comments.

regards, tom lane

#11Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#7)
Re: query optimizer

Tom Lane wrote:

Magnus Hagander <magnus@hagander.net> writes:

On Thu, Jul 19, 2007 at 10:41:03AM -0400, Tom Lane wrote:

The developers section of the website used to have slides from a couple
of talks I gave at OSCON, but I don't see them there anymore :-(

How long ago was this (that they were on the website)? I don't recall that
ever being removed, and I can't find it in the cvs either.

Hmm, I thought they were once on the same page as Bruce's papers, now
http://www.postgresql.org/developer/coding
but possibly I'm mistaken; it was well before the website reorg anyway.

If you still have the presentations, we can always add them back in... (I
recall reading them, but don't have a local copy)

Yeah, the PDFs are still in my home directory on cvs.postgresql.org.

Added to the website, will appear on next build.

//Magnus

#12Luca Ferrari
fluca1978@infinito.it
In reply to: Tom Lane (#10)
Re: query optimizer

On Saturday 21 July 2007 Tom Lane's cat, walking on the keyboard, wrote:

Beyond that, the GEQO chapter provides several references, and IMHO
you should not be all that resistant to looking into the source code.
Even if you don't read C well, many of the files provide a wealth of
info in the comments.

Thanks for you integration and, even if I'm not a C-expert, I'd like to read
the source code to better understand how postgres works. Nevertheless, since
the source code can be very long, it should be better to have a kind of uml
diagram or something similar to understand on which point of code to focus
on. That's what I was looking for.

Luca