{"action":"created","comment":{"url":"https://api.github.com/repos/influxdb/influxdb.com/pulls/comments/41690488","id":41690488,"diff_hunk":"@@ -0,0 +1,171 @@\n+---\n+title: Database management\n+aliases:\n+  - /docs/v0.9/query_language/database_administration.html\n+  - /docs/v0.9/query_language/database_management.html\n+---\n+\n+InfluxQL offers a full suite of administrative commands. \n+\n+* [Data management](../query_language/database_management.html#data-management)    \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Create a database with `CREATE DATABASE`](../query_language/database_management.html#create-a-database-with-create-database)    \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Delete a database with `DROP DATABASE`](../query_language/database_management.html#delete-a-database-with-drop-database)  \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Delete series with `DROP SERIES`](../query_language/database_management.html#delete-series-with-drop-series)  \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Delete measurements with `DROP MEASUREMENT`](../query_language/database_management.html#delete-measurements-with-drop-measurement)  \n+\n+* [Retention policy management](../query_language/database_management.html#retention-policy-management)  \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Create retention policies with `CREATE RETENTION POLICY`](../query_language/database_management.html#create-retention-policies-with-create-retention-policy)    \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Modify retention policies with `ALTER RETENTION POLICY`](../query_language/database_management.html#modify-retention-policies-with-alter-retention-policy)   \n+&nbsp;&nbsp;&nbsp;◦&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[Delete retention policies with `DROP RETENTION POLICY`](../query_language/database_management.html#delete-retention-policies-with-drop-retention-policy)   \n+\n+The examples in the sections below use InfluxDB's [Command Line Interface (CLI)](../introduction/getting_started.html). You can also execute the commands using the HTTP API; simply  send a `GET` request to the `/query` endpoint and include the command in the URL parameter `q`. See the [Querying Data](../guides/querying_data.html) guide for more on using the HTTP API.\n+\n+> **Note:** When authentication is enabled, only admin users can execute most of the commands listed on this page. See the documentation on [authentication and authorization](../administration/authentication_and_authorization.html) for more information.\n+\n+## Data management\n+\n+### Create a database with CREATE DATABASE\n+---\n+The `CREATE DATABASE` query takes the following form, where `IF NOT EXISTS` is optional:\n+```sql\n+CREATE DATABASE <database_name> IF NOT EXISTS\n+```\n+\n+Create the database ` NOAA_water_database`:\n+```sh\n+> CREATE DATABASE NOAA_water_database\n+>\n+```\n+\n+Create the database `NOAA_water_database` only if it doesn't already exist:\n+```sh\n+> CREATE DATABASE  NOAA_water_database\n+>\n+```\n+\n+InfluxDB provides no CLI response when it successfully creates a new database. In the first example, InfluxDB would return `ERR: database already exists` if the `NOAA_water_database` database already existed. In the second example, InfluxDB would not return an error if the `NOAA_water_database` database already existed.\n+\n+### Delete a database with DROP DATABASE\n+---\n+The `DROP DATABASE` query takes the following form:\n+```sql\n+DROP DATABASE <database_name> \n+```\n+\n+CLI example:\n+```sh\n+> DROP DATABASE NOAA_water_database\n+>\n+```\n+\n+InfluxDB provides no CLI response when it successfully deletes a database. It returns `ERR: database not found` if the specified database does not exist.\n+\n+### Delete series with DROP SERIES\n+---\n+The `DROP SERIES` query deletes [series](../concepts/glossary.html#series) in your database and takes the following form, where the query requires either the `FROM` clause or the `WHERE` clause:\n+```sql\n+DROP SERIES FROM <measurement_name[,measurement_name]> WHERE <tag_key='tag_value'>\n+```\n+\n+Delete all series from a single measurement:\n+```sql\n+> DROP SERIES FROM h2o_feet\n+```\n+\n+Delete series from a measurement that have a specific tag set:\n+```sql\n+> DROP SERIES FROM h2o_feet WHERE location = 'santa_monica'\n+```\n+\n+Delete series across all measurements in your database that have a specific tag set:\n+```sql\n+> DROP SERIES WHERE location = 'santa_monica'\n+```\n+\n+InfluxDB provides no CLI response when it successfully deletes series.\n+\n+<dt> Currently, InfluxDB does not support regular expressions with `DROP SERIES`. See GitHub Issue [#4276](https://github.com/influxdb/influxdb/issues/4276) for more information. </dt>\n+\n+### Delete measurements with DROP MEASUREMENT\n+---\n+The `DROP MEASUREMENT` query deletes all data from the specified measurement and takes the following form:\n+```sql\n+DROP MEASUREMENT <measurement_name>\n+```\n+\n+Delete the measurement `h2o_feet`:\n+```sql\n+> DROP MEASUREMENT h2o_feet\n+```\n+\n+InfluxDB provides no CLI response when it successfully deletes measurements.\n+\n+<dt> Currently, InfluxDB does not support regular expressions with `DROP MEASUREMENTS`. See GitHub Issue [#4275](https://github.com/influxdb/influxdb/issues/4275) for more information. </dt>\n+\n+## Retention Policy Management\n+The following sections cover how to list existing retention policies, create retention policies, change retention policies, and delete retention policies. Note that when you create a database, InfluxDB automatically creates a retention policy named `default` which has infinite retention. You may disable that auto-creation in the configuration file.\n+\n+### Create retention policies with CREATE RETENTION POLICY\n+---\n+The `CREATE RETENTION POLICY` query takes the following form, where `DEFAULT` is optional:\n+```sql\n+CREATE RETENTION POLICY <retention_policy_name> ON <database_name> DURATION <duration> REPLICATION <n> DEFAULT\n+```\n+","path":"content/docs/v0.9/query_language/database_management.md","position":128,"original_position":114,"commit_id":"8ea3ecc4d7fa7f2a6ab6aad92d6de38aa588ddb4","original_commit_id":"d312ee7c468fa0f60a819f4388fdd5fdfab73eba","user":{"login":"beckettsean","id":6537329,"avatar_url":"https://avatars.githubusercontent.com/u/6537329?v=3","gravatar_id":"","url":"https://api.github.com/users/beckettsean","html_url":"https://github.com/beckettsean","followers_url":"https://api.github.com/users/beckettsean/followers","following_url":"https://api.github.com/users/beckettsean/following{/other_user}","gists_url":"https://api.github.com/users/beckettsean/gists{/gist_id}","starred_url":"https://api.github.com/users/beckettsean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckettsean/subscriptions","organizations_url":"https://api.github.com/users/beckettsean/orgs","repos_url":"https://api.github.com/users/beckettsean/repos","events_url":"https://api.github.com/users/beckettsean/events{/privacy}","received_events_url":"https://api.github.com/users/beckettsean/received_events","type":"User","site_admin":false},"body":"Feels like we should describe DURATION and REPLICATION before giving examples.","created_at":"2015-10-10T00:52:07Z","updated_at":"2015-10-10T00:52:07Z","html_url":"https://github.com/influxdb/influxdb.com/pull/385#discussion_r41690488","pull_request_url":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385","_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb.com/pulls/comments/41690488"},"html":{"href":"https://github.com/influxdb/influxdb.com/pull/385#discussion_r41690488"},"pull_request":{"href":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385"}}},"pull_request":{"url":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385","id":47305607,"html_url":"https://github.com/influxdb/influxdb.com/pull/385","diff_url":"https://github.com/influxdb/influxdb.com/pull/385.diff","patch_url":"https://github.com/influxdb/influxdb.com/pull/385.patch","issue_url":"https://api.github.com/repos/influxdb/influxdb.com/issues/385","number":385,"state":"open","locked":false,"title":"Edit and restructure database management, authentication, and authorization","user":{"login":"rkuchan","id":8750814,"avatar_url":"https://avatars.githubusercontent.com/u/8750814?v=3","gravatar_id":"","url":"https://api.github.com/users/rkuchan","html_url":"https://github.com/rkuchan","followers_url":"https://api.github.com/users/rkuchan/followers","following_url":"https://api.github.com/users/rkuchan/following{/other_user}","gists_url":"https://api.github.com/users/rkuchan/gists{/gist_id}","starred_url":"https://api.github.com/users/rkuchan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rkuchan/subscriptions","organizations_url":"https://api.github.com/users/rkuchan/orgs","repos_url":"https://api.github.com/users/rkuchan/repos","events_url":"https://api.github.com/users/rkuchan/events{/privacy}","received_events_url":"https://api.github.com/users/rkuchan/received_events","type":"User","site_admin":false},"body":"Several things to note in this PR:\r\n\r\n* Divide database management queries and user admin commands:\r\n   \r\n    Created `query_language/database_management.md` that discusses `CREATE DATABASE`, `DROP DATABASE`, `DROP SERIES`, `DROP MEASUREMENT`, `CREATE RETENTION POLICY`, `ALTER RETENTION POLICY`, and `DROP RETENTION POLICY`.\r\n\r\n    Combined `administration/authentication.md` and `administration/authorization.md` into single `administration/authentication_and_authorization.md` for ease. All of the user-based commands are in this document.\r\n\r\n    Fixes https://github.com/influxdb/influxdb.com/issues/272, https://github.com/influxdb/influxdb.com/issues/360, https://github.com/influxdb/influxdb.com/issues/355\r\n\r\n* Added `SHOW RETENTION POLICIES` and `SHOW FIELD KEYS`  to `query_language/schema_exploration.md` so that most of the `SHOW` queries are in one place.\r\n\r\n    Fixes https://github.com/influxdb/influxdb.com/issues/230\r\n\r\n* Moved the `Troubleshooting` section below `Concepts` in the sidebar after verbal discussion with Sean.\r\n\r\n","created_at":"2015-10-09T18:40:42Z","updated_at":"2015-10-10T00:52:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e306daa213e048c51abc14cf293cefc4596aeb7d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385/commits","review_comments_url":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385/comments","review_comment_url":"https://api.github.com/repos/influxdb/influxdb.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/influxdb/influxdb.com/issues/385/comments","statuses_url":"https://api.github.com/repos/influxdb/influxdb.com/statuses/8ea3ecc4d7fa7f2a6ab6aad92d6de38aa588ddb4","head":{"label":"influxdb:admin_ed","ref":"admin_ed","sha":"8ea3ecc4d7fa7f2a6ab6aad92d6de38aa588ddb4","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":35440649,"name":"influxdb.com","full_name":"influxdb/influxdb.com","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/influxdb.com","description":"The main InfluxDB site","fork":false,"url":"https://api.github.com/repos/influxdb/influxdb.com","forks_url":"https://api.github.com/repos/influxdb/influxdb.com/forks","keys_url":"https://api.github.com/repos/influxdb/influxdb.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/influxdb.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/influxdb.com/teams","hooks_url":"https://api.github.com/repos/influxdb/influxdb.com/hooks","issue_events_url":"https://api.github.com/repos/influxdb/influxdb.com/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/influxdb.com/events","assignees_url":"https://api.github.com/repos/influxdb/influxdb.com/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/influxdb.com/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/influxdb.com/tags","blobs_url":"https://api.github.com/repos/influxdb/influxdb.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/influxdb.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/influxdb.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/influxdb.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/influxdb.com/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/influxdb.com/languages","stargazers_url":"https://api.github.com/repos/influxdb/influxdb.com/stargazers","contributors_url":"https://api.github.com/repos/influxdb/influxdb.com/contributors","subscribers_url":"https://api.github.com/repos/influxdb/influxdb.com/subscribers","subscription_url":"https://api.github.com/repos/influxdb/influxdb.com/subscription","commits_url":"https://api.github.com/repos/influxdb/influxdb.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/influxdb.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/influxdb.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/influxdb.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdb/influxdb.com/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/influxdb.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/influxdb.com/merges","archive_url":"https://api.github.com/repos/influxdb/influxdb.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/influxdb.com/downloads","issues_url":"https://api.github.com/repos/influxdb/influxdb.com/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/influxdb.com/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/influxdb.com/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/influxdb.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/influxdb.com/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/influxdb.com/releases{/id}","created_at":"2015-05-11T18:02:06Z","updated_at":"2015-10-07T15:18:54Z","pushed_at":"2015-10-09T23:05:11Z","git_url":"git://github.com/influxdb/influxdb.com.git","ssh_url":"git@github.com:influxdb/influxdb.com.git","clone_url":"https://github.com/influxdb/influxdb.com.git","svn_url":"https://github.com/influxdb/influxdb.com","homepage":null,"size":10605,"stargazers_count":13,"watchers_count":13,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":62,"forks":49,"open_issues":62,"watchers":13,"default_branch":"master"}},"base":{"label":"influxdb:master","ref":"master","sha":"74a621d8e2c8a89ce7435ec31415322b2db4347b","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":35440649,"name":"influxdb.com","full_name":"influxdb/influxdb.com","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/influxdb.com","description":"The main InfluxDB site","fork":false,"url":"https://api.github.com/repos/influxdb/influxdb.com","forks_url":"https://api.github.com/repos/influxdb/influxdb.com/forks","keys_url":"https://api.github.com/repos/influxdb/influxdb.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/influxdb.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/influxdb.com/teams","hooks_url":"https://api.github.com/repos/influxdb/influxdb.com/hooks","issue_events_url":"https://api.github.com/repos/influxdb/influxdb.com/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/influxdb.com/events","assignees_url":"https://api.github.com/repos/influxdb/influxdb.com/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/influxdb.com/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/influxdb.com/tags","blobs_url":"https://api.github.com/repos/influxdb/influxdb.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/influxdb.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/influxdb.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/influxdb.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/influxdb.com/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/influxdb.com/languages","stargazers_url":"https://api.github.com/repos/influxdb/influxdb.com/stargazers","contributors_url":"https://api.github.com/repos/influxdb/influxdb.com/contributors","subscribers_url":"https://api.github.com/repos/influxdb/influxdb.com/subscribers","subscription_url":"https://api.github.com/repos/influxdb/influxdb.com/subscription","commits_url":"https://api.github.com/repos/influxdb/influxdb.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/influxdb.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/influxdb.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/influxdb.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdb/influxdb.com/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/influxdb.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/influxdb.com/merges","archive_url":"https://api.github.com/repos/influxdb/influxdb.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/influxdb.com/downloads","issues_url":"https://api.github.com/repos/influxdb/influxdb.com/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/influxdb.com/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/influxdb.com/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/influxdb.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/influxdb.com/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/influxdb.com/releases{/id}","created_at":"2015-05-11T18:02:06Z","updated_at":"2015-10-07T15:18:54Z","pushed_at":"2015-10-09T23:05:11Z","git_url":"git://github.com/influxdb/influxdb.com.git","ssh_url":"git@github.com:influxdb/influxdb.com.git","clone_url":"https://github.com/influxdb/influxdb.com.git","svn_url":"https://github.com/influxdb/influxdb.com","homepage":null,"size":10605,"stargazers_count":13,"watchers_count":13,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":49,"mirror_url":null,"open_issues_count":62,"forks":49,"open_issues":62,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385"},"html":{"href":"https://github.com/influxdb/influxdb.com/pull/385"},"issue":{"href":"https://api.github.com/repos/influxdb/influxdb.com/issues/385"},"comments":{"href":"https://api.github.com/repos/influxdb/influxdb.com/issues/385/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdb/influxdb.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/influxdb/influxdb.com/pulls/385/commits"},"statuses":{"href":"https://api.github.com/repos/influxdb/influxdb.com/statuses/8ea3ecc4d7fa7f2a6ab6aad92d6de38aa588ddb4"}}}}