gitbase allows you to speed up queries creating indexes.
Indexes are implemented as bitmaps using pilosa as a backend storage for them.
Thus, to create indexes you must specify pilosa as the type of index. You can find some examples in the examples section about managing indexes.
Note that you can create an index either on one or more columns or on a single expression. In practice, having multiple indexes (one per column) is better and more flexible than one index for multiple columns. It is because of data structures (bitmaps) used to represent index values. Even if you have one index on multiple columns, every column is stored in an independent field. Merging those fields by any logic operations is fast and much more flexible. The main difference of having multiple columns per index is, it internally calculates intersection across columns, so the index won't be used if you use non
AND operation in a filter, e.g.:
With index on (
B), the index will be used for following query:
SELECT * FROM T WHERE A='...' AND B='...'
But it won't be used if we change logic operation to, e.g.:
SELECT * FROM T WHERE A='...' OR B='...'
So it's more flexible with two indexes - one on
A, and the second on
B. For the first query the intersection of two fields will be returned and for the second query also two indexes will be used and the result will be a union.
You can find some more examples in the examples section.
See go-mysql-server documentation for more details.