userfile, a per-user file storage. To interact with userfile, use the following :
Once a userfile is uploaded, you can run IMPORT INTO.
You can create an external connection to represent an external storage or sink URI. This allows you to specify the external connection’s name in statements rather than the provider-specific URI. For detail on using external connections, see the page.
Upload a file
A userfile uses storage space in the cluster, and is replicated with the rest of the cluster’s data. We recommend using for quick uploads from your client (about 15MB or smaller).
List files
Get files
Delete files
Import from userfile
To import from userfile, first create the table that you would like to import into:
IMPORT INTO to import data into the table:
userfile:/// references the default path (userfile://defaultdb.public.userfiles_$user/).
Backup and restore with userfile
We recommend starting backups from a time at least 10 seconds in the past using . Read our guidance in the section on the page.
Only database and table-level backups are possible when using
userfile as storage. Restoring cluster-level backups will not work because userfile data is stored in the defaultdb database, and you cannot restore a cluster with existing table data.userfile storage allows for database and table-level backups.
First, run the following statement to backup a database to a directory in the default userfile space:
When backing up from a cluster and restoring a database or table that is stored in your
userfile space to a different cluster, you can run to download the backup files to a local machine and to upload to the userfile of the restoring cluster.userfile:///bank-backup as userfile:/// refers to the default path userfile://defaultdb.public.userfiles_$user/.
Once the backup data is no longer needed, delete from the userfile storage with the following command:
cockroach userfile delete {file}, it will take as long as the to be removed from disk.

