Whenever you perform a filter on some predicate, that predicate always needs to have an index?
Example: You are looking at a list of companies. Companies have predicates such as names, locations, main contacts. You want to be able to filter companies based on these predicates (mainly using the GraphQL anyofterms function). Wouldn’t this require all of these indexes to have predicates (in the case of using anyofterms, the term index), and thus be memory expensive (as many indexes is costly)?
Yes, the term index does make sense for these predicates, and they will have to be created for
anyofterms
to be usable. There are a few switches in dgraph alpha around memory. Here is the relevant output from dgraph alpha --help
. The general tradeoff is between memory and performance i.e. better performance requires more memory.
--badger.tables string [ram, mmap, disk] Specifies how Badger LSM tree is stored. Option sequence consume most to least RAM while providing best to worst read performance respectively. (default "mmap")
--badger.vlog string [mmap, disk] Specifies how Badger Value log is stored. mmap consumes more RAM, but provides better performance. (default "mmap")
1 Like