Re: GiST, Not Using Index

From: Itai Zukerman <zukerman(at)math-hat(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: GiST, Not Using Index
Date: 2003-02-27 23:12:35
Message-ID: 87of4xs4gs.fsf@pip.dynamiclogic.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Ah. Your problem is you need to mark sig_in() as IMMUTABLE, or at
> least [...]

That was it! Thanks!

For your enjoyment:

test=# select count(*) from x;
count
--------
200000
(1 row)

test=# explain analyze select * from x where y ~>= sig_in('{1,2,3,4,5}'::int4[]);
QUERY PLAN
------------------------------------------------------------------------------------------------------
Index Scan using xx on x (cost=0.00..4.82 rows=1 width=8) (actual time=5.07..93.15 rows=29 loops=1)
Index Cond: (y ~>= '.*****..........................................................'::sig)
Total runtime: 93.31 msec
(3 rows)

test=# select * from x where y ~>= sig_in('{1,2,3,4,5}'::int4[]);
y
------------------------------------------------------------------
.*****.*..*..**.....*.*...*.*.*.....*....................*...*..
.*******.*..**.*.*.***...*....*.....**..*..*.*...**..**....**...
.*****..*...**......*.....*.....*....*..*...*...*..............*
.*****..*...**.....*....*.....*..*......**....*.......**...*....
******........*.**.....*...............**.........*.......*.....
.*****.*.**.*...***.............*...........*.**.*..*..**...*...
.******.*.*...*..*.****.*.*..**..*....**.*...***.*..*...****.**.
******....*..*.*.*.**.*..*....*..................*..*...*.......
*******..**..***.*..*...*...*.*.***.*.*...**...***.......*......
.*****..................*.*..*.*.....*...**.......*....**..**...
.******......*.*.**.*.*.*..*.....***.............**......**.....
******.*.....*.*...*......*...*.**.......*........***..*.*.....*
.******....*...*....***.*.*..*.*.....*..*......*..*.......*.....
*********.*..*.*...*...*.*.*.......................*.*....*...*.
.*****..............*.....................*....*...*...*....*..*
.*******.**.*..*....**.*.....*.....*..*.*.*..**....*...**..*...*
.*****............**..*..*.***....*...*.**.............*........
.*******...*.**.***..*.****.*..**..*....*.*.**.**.*..*........**
******.*...**..*..*.****..*...*..*.*..******.....*.*..*.**..*...
.*****.*....*..****.........*....*..*...*............**..*....**
*******.**.......*..*........*..*.***....*........**...**.....*.
******...*...........*.*.....**...**...*...**.....*...*.**...*..
.*****..............***.**.*...*....*...**.*...***......*..**...
******..**....*......**.*................*.*...*.**......*.*.**.
.*****....*.*.*...*.**..*......*...*..**.**.*...*...**....****..
.*****..*...*........*....*....*....*....................*...*..
.*****..**.*........*..*...*..*.*.*..*..*....**.*..***.*......*.
.*****...*.......................................*...........*..
*********........*.......*.......*..*.*...*....*.......*........
(29 rows)

test=# drop index xx;
DROP INDEX
test=# explain analyze select * from x where y ~>= sig_in('{1,2,3,4,5}'::int4[]);
QUERY PLAN
-----------------------------------------------------------------------------------------------
Seq Scan on x (cost=0.00..22.50 rows=1 width=8) (actual time=35.16..2231.98 rows=29 loops=1)
Filter: (y ~>= '.*****..........................................................'::sig)
Total runtime: 2232.18 msec
(3 rows)

--
Itai Zukerman <http://www.math-hat.com/~zukerman/>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Aaron Chu 2003-02-27 23:17:06 Beginner needs help
Previous Message Tom Lane 2003-02-27 22:38:43 Re: GiST, Not Using Index