def drop_orphan_stores(dry_run=False):
    """Drops all orphan execution stores from the database.

    Orphan stores are those that are associated with a dataset that no longer
    exists in the database.

    Args:
        dry_run (False): whether to log the actions that would be taken but not
            perform them
    """
    conn = get_db_conn()
    _logger = _get_logger(dry_run=dry_run)

    dataset_ids = set(conn.datasets.distinct("_id"))

    store_ids = set(conn.execution_store.distinct("dataset_id"))
    store_ids.discard(None)

    orphan_store_ids = list(store_ids - dataset_ids)

    if orphan_store_ids:
        _logger.info(
            "Deleting %d orphan store(s): %s",
            len(orphan_store_ids),
            orphan_store_ids,
        )
        if not dry_run:
            _delete_stores(conn, orphan_store_ids)
Drops all orphan execution stores from the database.

    Orphan stores are those that are associated with a dataset that no longer
    exists in the database.

    Args:
        dry_run (False): whether to log the actions that would be taken but not
            perform them
    
fiftyone/core/odm/database.py