Skip to content

Commit 5520190

Browse files
committed
docs: add create index examples
Signed-off-by: Manuel Carmona <[email protected]>
1 parent ec22a62 commit 5520190

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

docs/using-gitbase/examples.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,27 @@ FROM (
5555
) as t
5656
GROUP BY committer_email, month, repo_id
5757
```
58+
59+
## Create an index for columns on a table
60+
61+
You can create an index either on a specific column or on several columns:
62+
63+
```sql
64+
CREATE INDEX commits_hash_idx ON commits USING pilosa (commit_hash)
65+
66+
CREATE INDEX files_commit_path_blob_idx ON commit_files USING pilosa (commit_hash, file_path, blob_hash)
67+
```
68+
69+
## Create an index for an expression on a table
70+
71+
Note that just one expression at a time is allowed to be indexed.
72+
73+
```sql
74+
CREATE INDEX files_lang_idx ON files USING pilosa (language(file_path, blob_content))
75+
```
76+
77+
## Drop a table's index
78+
79+
```sql
80+
DROP INDEX files_lang_idx ON files
81+
```

0 commit comments

Comments
 (0)