Re: A general Q about index

Lists: pgsql-hackers
From: Soroosh Sardari <soroosh(dot)sardari(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: A general Q about index
Date: 2013-07-16 11:35:19
Message-ID: CAFUsPDbP6=MJwjFwnVza092TYpsMAS=BL+Xb2XmTgMQRESACgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi

I want to know how an index is created and used.
actually if you can show to me a simple start point, it would be great.

Regards,
Soroosh Sardari


From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A general Q about index
Date: 2013-07-16 14:27:44
Message-ID: 1373984864423-5763926.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

soroosh sardari wrote
> Hi
>
> I want to know how an index is created and used.
> actually if you can show to me a simple start point, it would be great.
>
> Regards,
> Soroosh Sardari

In the documentation there is a table of contents and listed on that table
is a section named "Indexes".

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/A-general-Q-about-index-tp5763912p5763926.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A general Q about index
Date: 2013-07-16 14:30:21
Message-ID: 1373985021322-5763928.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

David Johnston wrote
>
> soroosh sardari wrote
>> Hi
>>
>> I want to know how an index is created and used.
>> actually if you can show to me a simple start point, it would be great.
>>
>> Regards,
>> Soroosh Sardari
> In the documentation there is a table of contents and listed on that table
> is a section named "Indexes".
>
> David J.

Since you posted this to hacker you may mean you wish to know how to program
them as oppose to use them in SQL. I have no clue to this regard. If you
did mean "use in SQL" then the documentation is your friend and you also
should not have posted this question to -hackers but to -general instead;
probably should have posted there anyway to begin with and been more clear
as to what you mean by "created and used".

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/A-general-Q-about-index-tp5763912p5763928.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.


From: soroosh sardari <soroosh(dot)sardari(at)aut(dot)ac(dot)ir>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A general Q about index
Date: 2013-07-16 15:09:28
Message-ID: CAFUsPDboGSGMGMJ18O3zGUx5j3WNHRFPqKGH-5JqsSeH+HuEJA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jul 16, 2013 at 7:00 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:

> David Johnston wrote
> >
> > soroosh sardari wrote
> >> Hi
> >>
> >> I want to know how an index is created and used.
> >> actually if you can show to me a simple start point, it would be great.
> >>
> >> Regards,
> >> Soroosh Sardari
> > In the documentation there is a table of contents and listed on that
> table
> > is a section named "Indexes".
> >
> > David J.
>
> Since you posted this to hacker you may mean you wish to know how to
> program
> them as oppose to use them in SQL. I have no clue to this regard. If you
> did mean "use in SQL" then the documentation is your friend and you also
> should not have posted this question to -hackers but to -general instead;
> probably should have posted there anyway to begin with and been more clear
> as to what you mean by "created and used".
>
> David J.
>
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/A-general-Q-about-index-tp5763912p5763928.html
> Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>

Actually I mean the index in the source code, I want to know how index is
used in the backend for
execution of some query.
sorry my question is a bit ambiguous,
I start to read "src/backend/access/index/genam.c", and I think maybe this
file is not good way to start.
let me write a bunch of question to illustrate my point,
-How create an index for a table with specified field
-How index is stored in a page
-what module is responsible to fetch and swap out index pages
-Is there a kind of abstract class for all variant of index?


From: Soroosh Sardari <soroosh(dot)sardari(at)gmail(dot)com>
To: David Johnston <polobo(at)yahoo(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A general Q about index
Date: 2013-07-16 18:37:28
Message-ID: CAFUsPDb9QDhRcoCARa2yye6dYh22A4moHZ2BkieyQ2RXj-YV8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jul 16, 2013 at 7:00 PM, David Johnston <polobo(at)yahoo(dot)com> wrote:

> David Johnston wrote
> >
> > soroosh sardari wrote
> >> Hi
> >>
> >> I want to know how an index is created and used.
> >> actually if you can show to me a simple start point, it would be great.
> >>
> >> Regards,
> >> Soroosh Sardari
> > In the documentation there is a table of contents and listed on that
> table
> > is a section named "Indexes".
> >
> > David J.
>
> Since you posted this to hacker you may mean you wish to know how to
> program
> them as oppose to use them in SQL. I have no clue to this regard. If you
> did mean "use in SQL" then the documentation is your friend and you also
> should not have posted this question to -hackers but to -general instead;
> probably should have posted there anyway to begin with and been more clear
> as to what you mean by "created and used".
>
> David J.
>
>
>
>
> --
> View this message in context:
> http://postgresql.1045698.n5.nabble.com/A-general-Q-about-index-tp5763912p5763928.html
> Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

Actually I mean the index in the source code, I want to know how index is
used in the backend for
execution of some query.
sorry my question is a bit ambiguous,
I start to read "src/backend/access/index/genam.c", and I think maybe this
file is not good way to start.
let me write a bunch of question to illustrate my point,
-How create an index for a table with specified field
-How index is stored in a page
-what module is responsible to fetch and swap out index pages
-Is there a kind of abstract class for all variant of index?


From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: soroosh sardari <soroosh(dot)sardari(at)aut(dot)ac(dot)ir>
Cc: David Johnston <polobo(at)yahoo(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A general Q about index
Date: 2013-07-17 05:26:10
Message-ID: 51E62AF2.8050303@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 07/16/2013 11:09 PM, soroosh sardari wrote:
>
> Actually I mean the index in the source code, I want to know how index
> is used in the backend for
> execution of some query.
> sorry my question is a bit ambiguous,
> I start to read "src/backend/access/index/genam.c", and I think maybe
> this file is not good way to start.
> let me write a bunch of question to illustrate my point,
> -How create an index for a table with specified field
> -How index is stored in a page
> -what module is responsible to fetch and swap out index pages
> -Is there a kind of abstract class for all variant of index?

Start with the documentation:

http://www.postgresql.org/docs/current/static/internals.html

particularly:

http://www.postgresql.org/docs/current/static/indexam.html
http://www.postgresql.org/docs/current/static/gist.html
http://www.postgresql.org/docs/current/static/catalog-pg-index.html
http://www.postgresql.org/docs/current/static/catalog-pg-am.html

That should give you the ground work to understand the source code a bit
better. Then feel free to return with specific questions you don't feel
are explained by the documentation or code comments and aren't obvious
from the code.
--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services