
Zitat von
Gisman
Über funktionale Indexe kann ich leider nichts berichte, da ich das noch nicht gehört habe. Aber es hört sich mal gut an und ich werde nachher gleich mal danach suchen...
Grüssle und bis später
Uwe
Mal ein sinnfreies Beispiel dafür:
Code:
test=# create table test1 as select i, md5(i::text) as md5 from generate_Series(1,100000) i;
SELECT
test=# analyse test1;
ANALYZE
test=# explain analyse select * from test1 where substring(md5,5,10) = '12345';
QUERY PLAN
-------------------------------------------------------------------------------------------------------
Seq Scan on test1 (cost=0.00..2334.00 rows=500 width=37) (actual time=97.916..97.916 rows=0 loops=1)
Filter: ("substring"(md5, 5, 10) = '12345'::text)
Total runtime: 97.942 ms
(3 rows)
test=# create index idx1_test1 on test1((substring(md5,5,10)));
CREATE INDEX
test=# explain analyse select * from test1 where substring(md5,5,10) = '12345';
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------
Bitmap Heap Scan on test1 (cost=12.14..774.89 rows=500 width=37) (actual time=0.056..0.056 rows=0 loops=1)
Recheck Cond: ("substring"(md5, 5, 10) = '12345'::text)
-> Bitmap Index Scan on idx1_test1 (cost=0.00..12.02 rows=500 width=0) (actual time=0.053..0.053 rows=0 loops=1)
Index Cond: ("substring"(md5, 5, 10) = '12345'::text)
Total runtime: 0.078 ms
(5 rows) Andreas
Lesezeichen