Created
February 11, 2023 15:44
-
-
Save portnov/7a7827c4561ce91f3fc8191bdd66afe2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table tst_complex_index ( | |
id1 int not null, | |
id2 int not null, | |
value text, | |
primary key (id1, id2) | |
); | |
insert into tst_complex_index (id1, id2, value) | |
select (9*g.i + 177) % 100, (191*g.i + 197) % 10001, g.i || ' text ' || (g.i + 7) % 19 | |
from generate_series(1, 1000*1000) g (i); | |
explain (analyze,buffers) | |
select * from tst_complex_index | |
where id2 = 1 ; | |
QUERY PLAN | | |
--------------------------------------------------------------------------------------------------------------------------------------------------+ | |
Index Scan using tst_complex_index_pkey on tst_complex_index (cost=0.42..11637.42 rows=100 width=22) (actual time=0.015..17.965 rows=100 loops=1)| | |
Index Cond: (id2 = 1) | | |
Buffers: shared hit=3746 | | |
Planning Time: 0.040 ms | | |
Execution Time: 18.018 ms | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment