Backup timeout syntax confusion

I am having difficulty setting the timeout value on a database backup. I am getting an error during backups on one of my databases “took too long to fetch query result row” so to fix this I am trying to set the TIMEOUT value as specified in the docs.

BACKUP [DATABASE] <database_name> [TIMEOUT <timeout_value>] TO S3 "bucket/path"

For example:
BACKUP DATABASE mydb TIMEOUT 600000 TO S3 “mybucket/mypath”

The query only works when I omit the TIMEOUT element otherwise I get “Error 1064: You have an error in your SQL syntax;”

Any help would be appreciated on how to correctly set the TIMEOUT parameter.

Hello!

This might be a documentation issue. Try putting the TIMEOUT at the end of the statement (after the TO clause). Let me know if that works.

1 Like

Thanks a lot - that solved the syntax issue by putting TIMEOUT 600000 at the end.

Initially this didn’t help with the original issue of “took too long to fetch query result row” error. I realized that it was because of a timeout on the memsqlctl query --sql "BACKUP DATABASE…

I resolve by: memsqlctl query --row-timeout 10m --sql "BACKUP DATABASE…

Thanks again!

This is still not fixed in the document… crazy!

Check out the docs on the new documents site for the update with the TIMEOUT and other options listed after the TO: https://docs.singlestore.com/db/v8.1/reference/sql-reference/operational-commands/backup-database/

Hi @michael,

The document suggests to do something like this:

BACKUP [DATABASE] <database_name> TO S3 "bucket/path" TIMEOUT 600000 CREDENTIALS 
configuration_json:
'{"endpoint_url":"http://storage_provider_endpoint"
  [,"s3_force_path_style":"<true|false>"]
}'
credentials_json:
'{"aws_access_key_id": "replace_with_your_access_key_id",
  "aws_secret_access_key": "replace_with_your_secret_access_key"
}'

However that doesn’t work. The below one does.

BACKUP [DATABASE] <database_name> TO S3 "bucket/path" CREDENTIALS 
configuration_json:
'{"endpoint_url":"http://storage_provider_endpoint"
  [,"s3_force_path_style":"<true|false>"]
}'
credentials_json:
'{"aws_access_key_id": "replace_with_your_access_key_id",
  "aws_secret_access_key": "replace_with_your_secret_access_key"
}'  TIMEOUT 600000;

Thanks for clarifying!