Created
May 13, 2023 18:36
-
-
Save portnov/aeb9c79810fed992ef7c49d13270f934 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_bool ( | |
id bigint primary key generated always as identity, | |
value numeric, | |
isgood boolean | |
); | |
insert into tst_bool (value, isgood) | |
select random()*7, round(random()*4) = 1 | |
from generate_series(1, 1000*1000); | |
analyze tst_bool; | |
create index idx_tst_bool on tst_bool (isgood); | |
explain | |
select id, value from tst_bool where isgood = true; | |
QUERY PLAN | | |
-------------------------------------------------------------------------------------+ | |
Index Scan using idx_tst_bool on tst_bool (cost=0.42..14141.58 rows=248800 width=20)| | |
Index Cond: (isgood = true) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment