Thread: query optimizer

query optimizer

From
"jungmin shin"
Date:

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

--
Jungmin Shin

Re: query optimizer

From
Tom Lane
Date:
"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

Re: query optimizer

From
Luca Ferrari
Date:
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

Re: query optimizer

From
Tom Lane
Date:
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

Re: query optimizer

From
Greg Smith
Date:
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

Re: query optimizer

From
Magnus Hagander
Date:
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

Re: query optimizer

From
Tom Lane
Date:
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

Re: query optimizer

From
Alvaro Herrera
Date:
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

Re: query optimizer

From
Luca Ferrari
Date:
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

Re: query optimizer

From
Tom Lane
Date:
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

Re: query optimizer

From
Magnus Hagander
Date:
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


Re: query optimizer

From
Luca Ferrari
Date:
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