query | use index | planning time | exec time |
---|---|---|---|
where name ilike '%Shandeigh%'; |
false | <=0.1ms | ~300ms |
where name ilike '%Shandeigh%'; |
true | ~0.1ms | 0.05ms < x < 0.1ms |
where name ilike '%Shandeigh%' and created_at > '2022-07-01 08:41:14.515 +0700'; |
true | ~0.1ms | 0.05ms < x < 0.1ms |
where ts @@ to_tsquery('Shandeigh'); |
false | <= 0.09ms | ~700ms |
where ts @@ to_tsquery('Shandeigh'); |
true | ~0.1ms | ~0.05ms |
where ts @@ to_tsquery('Shandeigh') and created_at > '2022-07-01 08:41:14.515 +0700'; |
true | ~0.1ms | ~0.05ms |
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 INDEX trgm_idx_fts ON name USING GIN (ts); |
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
insert into MOCK_DATA (name, created_at) values (?, ?); |
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 MOCK_DATA ( | |
id SERIAL, | |
name VARCHAR(100), | |
created_at timestampz, | |
ts tsvector generated always as (to_tsvector('english'::regconfig, name)) stored | |
); |
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
SELECT 'a fat cat sat on a mat and ate a fat rat'::tsvector @@ 'cat & rat'::tsquery; |
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
SELECT name FROM mentors WHERE name LIKE '%ridho%'; |
id | name |
---|---|
1 | anakin skywalker |
2 | ridho rhoma |
3 | gabriel martinelli |
4 | elkan baggot |
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
#!/bin/bash | |
if [ "$1" == "" ]; then | |
echo "Please define what branch you want to keep" | |
else | |
eval git branch | grep -ve " $1$" | xargs git branch -D | |
fi |
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
names := []string{"John", "Doe"} | |
for index, name := range names { |
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
package main | |
import ( | |
"fmt" | |
) | |
func names() { | |
names := []string{"John", "Doe"} | |
for index, name := range names { |
NewerOlder