Re: [SQL] Optimizing perfomance using indexes

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: doka(at)root(dot)webest(dot)com
Cc: PgSQL-sql <pgsql-sql(at)postgreSQL(dot)org>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [SQL] Optimizing perfomance using indexes
Date: 1998-10-15 15:09:27
Message-ID: Pine.GSO.3.96.SK.981015190541.19322C-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

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(at)barnet(dot)kharkov(dot)ua>
> Reply-To: doka(at)root(dot)webest(dot)com
> To: PgSQL-sql <pgsql-sql(at)postgreSQL(dot)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(at)webest(dot)com>
>
>

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1998-10-15 15:10:23 Re: AW: [HACKERS] PostgreSQL v6.4 BETA2...
Previous Message Oleg Bartunov 1998-10-15 15:05:31 small bug in src/interfaces/ecpg/lib/Makefile.in

Browse pgsql-sql by date

  From Date Subject
Next Message Jackson, DeJuan 1998-10-15 15:25:11 RE: [SQL] Optimizing performance using indexes
Previous Message pierre 1998-10-15 13:53:23 Cluster(ing) to help joins?