From: Oleg Bartunov <oleg@sai.msu.su>
To: doka@root.webest.com
Cc: PgSQL-sql <pgsql-sql@postgreSQL.org>
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [SQL] Optimizing perfomance using indexes
Date: Thu, 15 Oct 1998 19:09:27 +0400 (MSD)
Message-ID: <Pine.GSO.3.96.SK.981015190541.19322C-100000@ra> (raw)
In-Reply-To: <Pine.LNX.4.03.9810151528040.23894-100000@barnet.kharkov.ua>
Hello,
What version of PostgreSQL you're talking about ?
I also noticed such behaivour in 6.4 beta, try
int4 instead of int2 and see what happens. I don't know the reason
but in my case it works. 6.3.2 uses indices in both cases !
Regards,
Oleg
On Thu, 15 Oct 1998, Vladimir Litovka wrote:
> Date: Thu, 15 Oct 1998 15:35:53 +0300 (EEST)
> From: Vladimir Litovka <pgsqll@barnet.kharkov.ua>
> Reply-To: doka@root.webest.com
> To: PgSQL-sql <pgsql-sql@postgreSQL.org>
> Subject: [SQL] Optimizing perfomance using indexes
>
> Hello!
>
> There are examples below and can anybody explain me - how to use indexes
> in PostgreSQL for best perfomance? Look here:
>
> create table aaa (num int2, name text);
> create index ax on aaa (num);
>
> explain select * from aaa where num = 5;
> Index Scan on aaa (cost=0.00 size=0 width=14)
>
> explain select * from aaa where num > 5;
> Seq Scan on aaa (cost=0.00 size=0 width=14)
>
> Why PostgreSQL in the first case uses index, but in the second - doesn't ?
> As I understand, there is no big difference between queries. Are there
> general recommendations on creating indexes?
>
> This questions because I'm relatively new to SQL and hope somebody can
> help me :) Thank you.
>
> ---
> Vladimir Litovka <doka@webest.com>
>
>
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: oleg@sai.msu.su, doka@root.webest.com, pgsql-hackers@postgreSQL.org
Subject: Re: [SQL] Optimizing perfomance using indexes
In-Reply-To: <Pine.GSO.3.96.SK.981015190541.19322C-100000@ra>
References: <Pine.LNX.4.03.9810151528040.23894-100000@barnet.kharkov.ua> <Pine.GSO.3.96.SK.981015190541.19322C-100000@ra>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox