Activate adaptive filtering in AlloyDB AI

Adaptive filtering in AlloyDB AI lets you optimize filtered vector searches by dynamically selecting between inline filtering and pre-filtering during query execution. You can activate adaptive filtering for your AlloyDB instance by enabling the scann.enable_preview_features database flag.

Enable adaptive filtering

To enable adaptive filtering, you must set the scann.enable_preview_features flag to on.

gcloud alloydb instances update INSTANCE_ID \
    --database-flags scann.enable_preview_features=on \
    --region=REGION \
    --cluster=CLUSTER_ID \
    --project=PROJECT_ID

Replace the following:

  • INSTANCE_ID: the ID of the instance where you want to enable adaptive filtering.
  • REGION: the region where your instance is located for example, us-central1.
  • CLUSTER_ID: the ID of the cluster where your instance is located.
  • PROJECT_ID: the ID of the project where your cluster is located.

Setting this flag to on activates the adaptive filtering behavior, allowing the query optimizer to dynamically switch between inline and pre-filtering strategies.

What's next