I have a couple of questions regarding channels:
1) Is there any way to query which channels are created in a bucket? if so, how?
2) Is there any limit on the channels that can be created by bucket?
We have a mobile application with about 15 different customers, they are all sharing the same bucket. We have created one channel per customer so that they don’t see each others info. We have also created a channel by day for some specific type of documents because we don’t want to keep old historic information in the mobile devices, so we also set a channel by date, in order to download only 2 days old info.
This approach of course is creating a bunch of channels (15 customers * daily channel). So question 3): Is there any risk with the amount of channels we are creating?
There’s not a standard way to find all the channels in use in the database. There’s an internal view used by SG that could be queried to find this out, but I haven’t been involved in SG development in a long time so I’m not sure if it still exists or how best to do that.
There isn’t a hard limit on the number of channels. There’s a view index whose size scales with the number of document-to-channel assignments (i.e. it has a row for each channel assigned to each doc), but view indexes are obviously designed to be highly scaleable. There are some in-memory caches but only for channels that have been recently requested in _changes feeds.
The number of channels you’re creating sounds reasonable, especially since it’s likely that only a few of the channels will be queried at any particular time.