Hello,
Filestream is not supported on the Cloud SQL (SQL Server).
Is there any workaround to overcome this issue?
Thanks
Outside of running a self-managed SQL Server (SQL Server on GCE), there are few possible workarounds to overcome the lack of Filestream support in Google Cloud SQL for MS SQL Server.
Workaround Solutions:
1. Object Storage (GCS):
How it Works:
Instead of storing BLOBs directly in the database, use GCS to store your files. Your SQL Server database would then store references (e.g., URLs or file paths) to these objects in GCS.
Scalability: GCS offers excellent scalability for storing large amounts of data.
Performance: Optimized for handling BLOBs.
Integration: Google Cloud offers native integration between Cloud SQL and GCS.
Considerations:
You'll need to manage the interaction between your SQL Server code and GCS.
2. Remote File Shares:
How it Works:
Set up a file share (e.g., SMB) on a virtual machine or another system (like Filestore) that is accessible to your Cloud SQL instance. Store your BLOBs on this file share.
More similar to the traditional Filestream approach if you already have a file server infrastructure.
Considerations:
Involves additional setup and management of the file share.
Security is crucial when exposing a file share over the network.
3. VARBINARY(MAX) Column:
How it Works:
Store smaller BLOBs directly within a VARBINARY(MAX) column in your SQL Server database. This is suitable for BLOBs that aren't too large.
Simplest solution if your BLOBs fit within the size limits of VARBINARY(MAX).
Considerations:
Not ideal for very large BLOBs as it can impact database performance.
The best workaround depends on your specific requirements:
BLOB Size:
For large BLOBs, GCS is usually the most scalable and performant option.
For smaller BLOBs, VARBINARY(MAX) might be sufficient.
Existing Infrastructure: If you already have a file share system, using it might be the easiest path.
Performance Needs: GCS tends to offer the best performance for handling BLOBs.