Welcome to the SQLite Storage feature for CB Pro Proxy! This guide will help you understand, enable, and use the new high-performance storage system.
- What is SQLite Storage?
- Benefits
- When to Use SQLite Storage
- How to Enable SQLite Storage
- Understanding the Migration Process
- How to Verify It's Working
- How to Disable and Rollback
- Performance Expectations
- FAQ
- Known Limitations
- Troubleshooting
SQLite Storage is a new, high-performance storage backend for CB Pro Proxy that replaces the traditional AsyncStorage system. It uses a local SQLite database to store your proxy profiles, providing significantly faster operations, especially when managing large numbers of profiles.
- 🚀 15-40x Faster Bulk Operations - Delete hundreds of profiles in seconds instead of minutes
- 📊 Efficient Data Management - Optimized queries and indexing for quick access
- 🔄 Automatic Migration - Seamlessly migrates your existing profiles
- 🔒 Secure Credentials - Passwords remain encrypted in SecureStore
- 🔁 Native Sync - Automatic synchronization with Android native module
- ↩️ Rollback Support - Safe migration with automatic rollback on failure
SQLite Storage delivers dramatic performance improvements over AsyncStorage:
| Operation | Profile Count | AsyncStorage | SQLite | Improvement |
|---|---|---|---|---|
| Bulk Delete | 100 | ~10 seconds | ~0.5 seconds | 20x faster |
| Bulk Delete | 500 | ~50 seconds | ~2 seconds | 25x faster |
| Bulk Delete | 1000 | ~100 seconds | ~3.5 seconds | 28x faster |
| Load Profiles | 500 | ~2-3 seconds | ~0.5-1 second | 2-3x faster |
| Bulk Create | 100 | ~10 seconds | ~1 second | 10x faster |
- Better Scalability - Handle thousands of profiles without performance degradation
- Reliable Transactions - All-or-nothing operations prevent data corruption
- Advanced Queries - Fast searching and filtering by name, host, tags, or type
- Data Integrity - Foreign key constraints ensure consistent relationships
- Efficient Storage - Optimized database structure reduces storage footprint
- You manage 50+ proxy profiles
- You frequently bulk delete profiles
- You need fast profile loading times
- You want better performance overall
- You're comfortable with new features
- You have fewer than 20 profiles
- You prefer proven stability over performance
- You're experiencing device storage issues
- You need to troubleshoot existing problems first
Recommendation: For most users with 50+ profiles, SQLite Storage provides significant benefits with minimal risk.
-
Open the App
- Launch CB Pro Proxy on your device
-
Navigate to Settings
- Tap the Settings icon (⚙️) in the navigation bar
-
Find Storage Settings
- Scroll to the "Storage" section
- Look for "Use SQLite Storage" option
-
Enable SQLite
- Toggle the "Use SQLite Storage" switch to ON
- A confirmation dialog will appear
-
Confirm Migration
- Read the migration information
- Tap "Enable and Migrate" to proceed
- Note: This process is automatic and safe
-
Wait for Migration
- A progress indicator will show migration status
- Do not close the app during migration
- Migration typically takes 15-30 seconds for 500 profiles
-
Verify Success
- You'll see a success message when complete
- Your profiles will load normally
- Performance improvements are immediate
For automation or remote management:
# Enable SQLite storage via ADB
adb shell am broadcast -n com.cbv.vpn/.VPNIntentReceiver \
-a com.cbv.vpn.ENABLE_SQLITE_STORAGE
# Check migration status
adb shell am broadcast -n com.cbv.vpn/.VPNIntentReceiver \
-a com.cbv.vpn.GET_STORAGE_STATUSWhen you enable SQLite Storage, the app automatically migrates your existing data:
-
Initialization
- SQLite database is created
- Schema and indexes are set up
-
Data Migration
- All profiles copied from AsyncStorage to SQLite
- Credentials remain in SecureStore (encrypted)
- Tags and metadata preserved
-
Validation
- Profile count verified
- Data integrity checked
- Migration flag set
-
Completion
- Success message displayed
- App switches to SQLite mode
- Performance improvements active
Profile Count | Expected Duration
--------------|------------------
0-50 | < 5 seconds
50-100 | 5-10 seconds
100-500 | 15-25 seconds
500-1000 | 30-45 seconds
1000+ | 45-60 seconds
✅ Migrated:
- Profile names
- Proxy hosts and ports
- Proxy types (SOCKS5/HTTP)
- DNS settings
- Tags
- Creation/update timestamps
- Authentication flags
✅ Preserved in SecureStore:
- Usernames
- Passwords
❌ Not Migrated:
- Temporary connection states
- UI preferences (separate storage)
- Automatic Rollback - If migration fails, all changes are reverted
- Data Preservation - Original AsyncStorage data remains intact during migration
- Validation - Profile counts verified before and after
- Error Handling - Clear error messages if issues occur
-
Settings Screen
- "Use SQLite Storage" toggle is ON
- Status shows "SQLite Active"
-
Performance
- Profile list loads noticeably faster
- Bulk operations complete in seconds
- UI remains responsive during operations
-
Logs
- Check app logs for SQLite-related messages
- Look for "Database initialized successfully"
// In app console or logs
console.log('SQLite enabled:', storageService.isSQLiteEnabled());
// Expected: true// Check profile count matches
const profiles = await storageService.getProfiles();
console.log('Profile count:', profiles.length);- Select 10+ profiles
- Delete them using bulk delete
- Operation should complete in < 1 second
# Check if database file exists
adb shell ls /data/data/com.cbv.vpn/databases/cbv_vpn.db
# Count profiles in database
adb shell "sqlite3 /data/data/com.cbv.vpn/databases/cbv_vpn.db 'SELECT COUNT(*) FROM profiles;'"
# View migration status
adb logcat | grep -i "migration"You might want to disable SQLite Storage if:
- You experience unexpected issues
- You need to troubleshoot problems
- You prefer the previous storage system
- You're downgrading to an older app version
-
Open Settings
- Navigate to Settings → Storage
-
Disable SQLite
- Toggle "Use SQLite Storage" to OFF
- Confirm the action
-
Restart App
- Close and reopen the app
- App will use AsyncStorage again
-
Verify
- Check that profiles still load correctly
- AsyncStorage mode is active
# Disable SQLite storage
adb shell am broadcast -n com.cbv.vpn/.VPNIntentReceiver \
-a com.cbv.vpn.DISABLE_SQLITE_STORAGE- Disabling SQLite does NOT delete your profiles
- Profiles remain in both SQLite and AsyncStorage
- You can re-enable SQLite anytime without re-migration
- When SQLite is enabled, data is written to both storages
- This ensures you can safely switch back to AsyncStorage
- No data loss when disabling SQLite
- If you re-enable SQLite, migration won't run again
- Existing SQLite data is reused
- Only new profiles since disabling are synced
-
Faster Profile Loading
- Profile list appears 2-3x faster
- Especially noticeable with 100+ profiles
- Smooth scrolling even with large lists
-
Instant Bulk Operations
- Bulk delete: 15-40x faster
- Bulk create: 8-12x faster
- Bulk update: 10-15x faster
-
Responsive UI
- No freezing during operations
- Background processing
- Progress indicators work smoothly
Scenario 1: Managing 500 Profiles
- Before (AsyncStorage): Deleting all takes ~50 seconds
- After (SQLite): Deleting all takes ~2 seconds
- Improvement: 25x faster
Scenario 2: Loading Profile List
- Before: 2-3 second load time
- After: 0.5-1 second load time
- Improvement: 2-3x faster
Scenario 3: Searching Profiles
- Before: Linear search through all profiles
- After: Indexed database query
- Improvement: Near-instant results
-
Regular Maintenance
- Periodically clean up unused profiles
- Remove old test profiles
- Keep database optimized
-
Optimal Usage
- Use bulk operations when possible
- Leverage search and filter features
- Take advantage of tags for organization
-
Monitor Performance
- Check app logs for slow queries
- Report performance issues
- Keep app updated
Q: Will enabling SQLite delete my existing profiles? A: No! Migration safely copies all profiles to SQLite. Your original data remains in AsyncStorage as a backup.
Q: Can I switch back to AsyncStorage? A: Yes, you can disable SQLite anytime. Your profiles remain accessible in both storage systems.
Q: Do I need to re-migrate if I disable and re-enable SQLite? A: No, the migration only runs once. Re-enabling SQLite uses the existing database.
Q: Are my passwords safe in SQLite? A: Yes! Passwords are NOT stored in SQLite. They remain encrypted in SecureStore, just like before.
Q: How much storage space does SQLite use? A: SQLite is very efficient. 1000 profiles typically use < 1MB of storage.
Q: How long does migration take? A: Typically 15-30 seconds for 500 profiles. See Migration Timeline for details.
Q: What happens if migration fails? A: The app automatically rolls back changes and falls back to AsyncStorage. Your data is safe.
Q: Can I use the app during migration? A: It's best to wait. Migration is quick and the app will be responsive afterward.
Q: Will migration affect my VPN connection? A: No, active VPN connections are not affected by migration.
Q: Why is SQLite so much faster? A: SQLite uses optimized database operations, transactions, and indexing instead of sequential file operations.
Q: Will I notice improvements with only 20 profiles? A: Improvements are less noticeable with small profile counts. Benefits increase with more profiles.
Q: Does SQLite use more battery? A: No, SQLite is actually more efficient and may use slightly less battery for large operations.
Q: Can SQLite handle 10,000+ profiles? A: Yes! SQLite can efficiently handle tens of thousands of profiles.
Q: Where is the SQLite database stored?
A: /data/data/com.cbv.vpn/databases/cbv_vpn.db on Android devices.
Q: Can I backup the SQLite database? A: Yes, you can use ADB to pull the database file for backup purposes.
Q: Does SQLite work on iOS? A: SQLite support is currently Android-only. iOS support is planned for future releases.
Q: Can I inspect the database? A: Yes, advanced users can use ADB and sqlite3 to inspect the database. See Testing Guide.
-
Android Only
- SQLite storage is currently available on Android only
- iOS support planned for future release
- iOS continues using AsyncStorage
-
One-Way Migration
- Migration is one-time only
- Cannot "un-migrate" back to AsyncStorage-only
- Can disable SQLite but data remains in both storages
-
Storage Space
- Dual-write mode uses slightly more storage
- Both SQLite and AsyncStorage contain profile data
- Minimal impact (< 2MB for 1000 profiles)
-
Compatibility
- Requires app version 1.0.7 or higher
- Older app versions cannot read SQLite data
- Downgrading requires disabling SQLite first
- iOS support
- Database compression
- Advanced query features
- Performance analytics
- Automatic optimization
Symptoms:
- Error message during migration
- Profiles don't appear after enabling
- App falls back to AsyncStorage
Solutions:
- Check available storage space (need at least 10MB free)
- Restart the app and try again
- Check app logs for specific error
- Contact support if issue persists
Prevention:
- Ensure stable device state before migration
- Close other apps to free memory
- Don't interrupt migration process
Symptoms:
- Profile list appears empty
- Some profiles missing
- Profile count doesn't match
Solutions:
- Pull down to refresh the profile list
- Check if SQLite is actually enabled in Settings
- Verify migration completed successfully
- Check app logs for errors
Verification:
# Check profile count via ADB
adb shell "sqlite3 /data/data/com.cbv.vpn/databases/cbv_vpn.db 'SELECT COUNT(*) FROM profiles;'"Symptoms:
- Operations slower than expected
- UI freezes or lags
- No performance improvement noticed
Solutions:
- Verify SQLite is enabled (Settings → Storage)
- Restart the app
- Check device storage performance
- Run database optimization:
- Settings → Storage → Optimize Database
Check:
- Ensure you have 50+ profiles (benefits increase with scale)
- Verify device has sufficient free storage
- Check for other apps consuming resources
Symptoms:
- VPN connection fails with authentication error
- Credentials appear empty
- "Invalid username/password" errors
Solutions:
- Credentials are stored separately in SecureStore
- Re-enter credentials for affected profiles
- Migration didn't affect credentials
- Check SecureStore accessibility
Note: Credentials are never stored in SQLite for security reasons.
Symptoms:
- "Database is locked" error
- Operations fail randomly
- App becomes unresponsive
Solutions:
- Close and restart the app
- Ensure no other processes accessing database
- Clear app cache if issue persists
- Disable and re-enable SQLite if needed
Prevention:
- Don't force-close app during operations
- Allow operations to complete
- Keep app updated
Symptoms:
- App using more storage than expected
- Device running low on space
Solutions:
- Dual-write mode keeps data in both storages temporarily
- Clean up old/unused profiles
- Run database optimization (Settings → Storage → Optimize)
- Consider disabling SQLite if storage is critical
Storage Breakdown:
- SQLite database: ~1KB per profile
- AsyncStorage backup: ~1KB per profile
- Total: ~2KB per profile (minimal)
If you encounter issues not covered here:
-
Check App Logs
- Settings → Logs → View Logs
- Look for errors related to "database" or "migration"
-
Review Documentation
- Testing Guide - Technical details
- Implementation Guide - Developer info
-
Contact Support
- Include device information
- Provide steps to reproduce
- Share relevant log excerpts
- Mention app version
-
Community Resources
- Check GitHub issues
- Search existing solutions
- Report new bugs
-
Use Bulk Operations
- Select multiple profiles for deletion
- Take advantage of 15-40x speed improvement
- More efficient than individual operations
-
Organize with Tags
- Tag profiles by region, type, or purpose
- Use filters to quickly find profiles
- Tags are indexed for fast searching
-
Regular Cleanup
- Remove unused profiles periodically
- Keep database lean and fast
- Better performance with organized data
-
Keep App Updated
- Updates include performance improvements
- Bug fixes and optimizations
- New features and enhancements
-
Monitor Performance
- Notice any slowdowns
- Check logs for warnings
- Report issues early
-
Backup Important Profiles
- Export profile configurations
- Keep backup of critical proxies
- Use ADB to backup database if needed
-
Credentials
- Always stored encrypted in SecureStore
- Never in SQLite database
- Secure by design
-
Database Access
- Only app can access database
- Protected by Android security
- No external access without root
-
Migration Safety
- Automatic rollback on failure
- Data preserved in AsyncStorage
- Safe to enable/disable
SQLite enables powerful search capabilities:
Search by Name or Host:
- Type in search box
- Instant results with indexing
- Case-insensitive matching
Filter by Type:
- SOCKS5 or HTTP
- Quick type-based filtering
- Efficient database queries
Filter by Tags:
- Select one or more tags
- Profiles matching any tag shown
- Combine with search for precision
Take advantage of batch processing:
Bulk Delete:
- Select multiple profiles
- Delete in single transaction
- 15-40x faster than sequential
Bulk Create:
- Import multiple profiles
- Efficient batch insertion
- Progress tracking
Bulk Update:
- Update multiple profiles at once
- Transaction-based safety
- All-or-nothing guarantee
Keep your database running smoothly:
Automatic Optimization:
- Indexes maintained automatically
- Query plans optimized
- Background maintenance
Manual Optimization:
- Settings → Storage → Optimize Database
- Reclaims unused space
- Rebuilds indexes
- Recommended after bulk deletions
Situation: Fresh install, no existing profiles
What Happens:
- Enable SQLite in Settings
- No migration needed (no data)
- Start creating profiles directly in SQLite
- Enjoy performance benefits immediately
Recommendation: Enable SQLite from the start for best experience.
Situation: Using app with small number of profiles
What Happens:
- Enable SQLite in Settings
- Quick migration (< 5 seconds)
- All profiles transferred
- Modest performance improvement
Recommendation: Optional but recommended for future scalability.
Situation: Managing large proxy farm
What Happens:
- Enable SQLite in Settings
- Migration takes 15-30 seconds
- Dramatic performance improvement
- Bulk operations 25x faster
Recommendation: Highly recommended! Significant benefits.
Situation: Frequently adding/removing test profiles
What Happens:
- Enable SQLite for faster operations
- Bulk delete test profiles instantly
- Efficient data management
- Better development workflow
Recommendation: Essential for testing workflows.
Pros:
- ✅ Proven stability
- ✅ Simple implementation
- ✅ Works on all platforms
Cons:
- ❌ Slow with large datasets
- ❌ Sequential operations
- ❌ No advanced queries
- ❌ Limited scalability
Best For:
- Small profile counts (< 20)
- Simple use cases
- Maximum compatibility
Pros:
- ✅ 15-40x faster bulk operations
- ✅ Efficient queries and indexing
- ✅ Handles thousands of profiles
- ✅ Transaction safety
- ✅ Advanced search/filter
Cons:
⚠️ Android only (currently)⚠️ Slightly more storage (dual-write)⚠️ Newer feature (less battle-tested)
Best For:
- Large profile counts (50+)
- Frequent bulk operations
- Power users
- Performance-critical workflows
Profiles Table:
- Stores profile metadata
- Indexed for fast queries
- Foreign key constraints
Profile Tags Table:
- Many-to-many relationship
- Efficient tag management
- Cascade deletion
Sync Log Table:
- Tracks native synchronization
- Retry mechanism
- Status monitoring
┌─────────────────────────────────────┐
│ Application Layer │
├─────────────────────────────────────┤
│ StorageService (Facade) │
├──────────────┬──────────────────────┤
│ SQLite │ AsyncStorage │
│ (Primary) │ (Backup) │
├──────────────┴──────────────────────┤
│ SecureStore │
│ (Credentials Only) │
└─────────────────────────────────────┘
-
Write Operation:
- Data written to SQLite (primary)
- Also written to AsyncStorage (backup)
- Credentials to SecureStore (encrypted)
-
Read Operation:
- Read from SQLite (fast)
- Credentials from SecureStore
- Combined into complete profile
-
Migration:
- Read from AsyncStorage
- Write to SQLite
- Validate and confirm
- Set migration flag
AsyncStorage: React Native's key-value storage system (legacy)
Bulk Operation: Processing multiple items in a single transaction
Dual-Write Mode: Writing data to both SQLite and AsyncStorage simultaneously
Foreign Key: Database constraint ensuring referential integrity
Index: Database structure for fast data retrieval
Migration: One-time process of moving data from AsyncStorage to SQLite
Rollback: Reverting changes when an operation fails
SecureStore: Encrypted storage for sensitive data (passwords)
SQLite: Embedded relational database system
Transaction: Group of operations that succeed or fail together
New Features:
- ✨ SQLite storage backend
- ✨ Automatic migration from AsyncStorage
- ✨ 15-40x faster bulk operations
- ✨ Advanced search and filtering
- ✨ Native synchronization
Improvements:
- ⚡ Profile loading 2-3x faster
- ⚡ Bulk delete 25x faster (500 profiles)
- ⚡ Efficient database queries
- ⚡ Better scalability
Technical:
- 📦 expo-sqlite v15.0.4
- 🔧 Transaction-based operations
- 🔧 Automatic rollback on failure
- 🔧 Dual-write mode for safety
- Testing Guide - Comprehensive testing procedures
- Implementation Guide - Developer documentation
- Feature Design - Architecture and design decisions
- Quick Start Guide - Getting started with the app
We value your feedback on the SQLite Storage feature!
- Performance Improvements: How much faster is your workflow?
- Issues Encountered: What problems did you face?
- Feature Requests: What would make it better?
- Use Cases: How are you using the feature?
When reporting issues, please include:
- Device model and Android version
- App version
- Number of profiles
- Steps to reproduce
- Expected vs actual behavior
- Relevant log excerpts
Interested in contributing?
- Check the Contributing Guide
- Review open issues on GitHub
- Submit pull requests
- Help improve documentation
SQLite Storage is a powerful upgrade that delivers:
- 🚀 15-40x faster bulk operations
- 📊 Better scalability for large profile counts
- 🔒 Same security with encrypted credentials
- 🔄 Safe migration with automatic rollback
- ↩️ Reversible - can disable anytime
Ready to get started? Follow the How to Enable section above!
For technical details and testing procedures, see the Testing Guide.
Last Updated: December 2024
App Version: 1.0.7+
Feature Status: ✅ Production Ready (Android)