Re: index theory

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: pgsql-hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: index theory
Date: 2002-10-16 15:47:00
Message-ID: 1034783220.6641.29.camel@taru.tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Karel Zak kirjutas K, 16.10.2002 kell 15:19:
>
> Hi,
>
> I have SQL query:
>
> SELECT * FROM ii WHERE i1='a' AND i2='b';
>
> There're indexes on i1 and i2. I know best solution is use one
> index on both (i1, i2).
>
> The EXPLAIN command show that optimalizer wants to use one index:
>
> test=# explain SELECT * FROM ii WHERE i1='a' AND i1='b';
> QUERY PLAN
> ---------------------------------------------------------------------------------
> Index Scan using i1 on ii (cost=0.00..4.83 rows=1 width=24)
> Index Cond: ((i1 = 'a'::character varying) AND (i1 = 'b'::character varying))
>
>
> It's right and I undererstand why not use both indexes. But I talked
> about it with one Oracle user and he said me Oracle knows use both indexes
> and results from both index scans are mergeted to final result -- this is maybe
> used if full access to table (too big rows?) is more expensive than 2x index
> scan and final merge. Is in PG possible something like this?

There has been some talk about using bitmaps generated from indexes as
an intermediate step.

----------
Hannu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David Walker 2002-10-16 16:33:35 Re: Vacuum improvement
Previous Message Bruce Momjian 2002-10-16 15:05:40 Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c