-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sequence caching and misc updates to SERIAL and CREATE/ALTER SEQUENCE pages #10219
Conversation
46d44fc
to
68aa204
Compare
@ajwerner |
Big yikes on not showing the cache value. Nice job finding that. |
@ajwerner Ping on review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll backport the below PR into 21.1.1
Reviewable status: complete! 1 of 0 LGTMs obtained
68aa204
to
761c6b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some small nits and added links.
v20.1/serial.md
Outdated
|
||
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative feature, introduced in v2.0, is the [`SEQUENCE`](create-sequence.html). | ||
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative feature is the [`SEQUENCE`](create-sequence.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative feature is the [`SEQUENCE`](create-sequence.html). | |
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative is to use [`SEQUENCE`](create-sequence.html). |
v20.2/create-sequence.md
Outdated
|
||
In this example, we create a sequence that starts at -1 and descends in increments of 2. | ||
In this example, we [create a table](create-table.html), using the `nextval()` function for a [default value](default-value.html), with the `customer_seq` sequence as its input: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, we [create a table](create-table.html), using the `nextval()` function for a [default value](default-value.html), with the `customer_seq` sequence as its input: | |
In this example, we [create a table](create-table.html), using the [`nextval()` function](functions-and-operators.html#sequence-functions) for a [default value](default-value.html), with the `customer_seq` sequence as its input: |
v20.2/create-sequence.md
Outdated
|
||
### Set the next value of a sequence | ||
|
||
In this example, we're going to change the next value of `customer_seq` using the `setval()` function. Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, we're going to change the next value of `customer_seq` using the `setval()` function. Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`. | |
In this example, we're going to change the next value of `customer_seq` using the [`setval()` function](functions-and-operators.html#sequence-functions). Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`. |
v20.2/serial.md
Outdated
|
||
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative feature, introduced in v2.0, is the [`SEQUENCE`](create-sequence.html). | ||
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative feature is the [`SEQUENCE`](create-sequence.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative feature is the [`SEQUENCE`](create-sequence.html). | |
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative is to use [`SEQUENCE`](create-sequence.html). |
v21.1/create-sequence.md
Outdated
|
||
In this example, we create a sequence that starts at -1 and descends in increments of 2. | ||
In this example, we [create a table](create-table.html), using the `nextval()` function for a [default value](default-value.html), with the `customer_seq` sequence as its input: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, we [create a table](create-table.html), using the `nextval()` function for a [default value](default-value.html), with the `customer_seq` sequence as its input: | |
In this example, we [create a table](create-table.html), using the [`nextval()` function](functions-and-operators.html#sequence-functions) for a [default value](default-value.html), with the `customer_seq` sequence as its input: |
v21.1/create-sequence.md
Outdated
|
||
### Set the next value of a sequence | ||
|
||
In this example, we're going to change the next value of `customer_seq` using the `setval()` function. Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this example, we're going to change the next value of `customer_seq` using the `setval()` function. Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`. | |
In this example, we're going to change the next value of `customer_seq` using the [`setval()` function](functions-and-operators.html#sequence-functions). Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TFTR @ianjevans !
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @ianjevans)
v20.1/serial.md, line 238 at r1 (raw file):
Previously, ianjevans (Ian Evans) wrote…
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative is to use [`SEQUENCE`](create-sequence.html).
Done.
v20.2/create-sequence.md, line 134 at r1 (raw file):
Previously, ianjevans (Ian Evans) wrote…
In this example, we [create a table](create-table.html), using the [`nextval()` function](functions-and-operators.html#sequence-functions) for a [default value](default-value.html), with the `customer_seq` sequence as its input:
Done.
v20.2/create-sequence.md, line 198 at r1 (raw file):
Previously, ianjevans (Ian Evans) wrote…
In this example, we're going to change the next value of `customer_seq` using the [`setval()` function](functions-and-operators.html#sequence-functions). Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`.
Done.
v20.2/serial.md, line 228 at r1 (raw file):
Previously, ianjevans (Ian Evans) wrote…
In summary, the `SERIAL` type in PostgreSQL and CockroachDB, and the `AUTO_INCREMENT` type in MySQL, all behave the same in that they do not create strict sequences. CockroachDB will likely create more gaps than these other databases, but will generate these values much faster. An alternative is to use [`SEQUENCE`](create-sequence.html).
Done.
v21.1/create-sequence.md, line 134 at r1 (raw file):
Previously, ianjevans (Ian Evans) wrote…
In this example, we [create a table](create-table.html), using the [`nextval()` function](functions-and-operators.html#sequence-functions) for a [default value](default-value.html), with the `customer_seq` sequence as its input:
Done.
v21.1/create-sequence.md, line 198 at r1 (raw file):
Previously, ianjevans (Ian Evans) wrote…
In this example, we're going to change the next value of `customer_seq` using the [`setval()` function](functions-and-operators.html#sequence-functions). Currently, the next value will be `3` (i.e., `2` + `INCREMENT 1`). We will change the next value to `5`.
Done.
761c6b7
to
7278971
Compare
Fixes #7741.
Fixes #10094.
Fixes #10093.
Coupled with cockroachdb/cockroach#62877.
This PR includes:
CREATE SEQUENCE
andALTER SEQUENCE
.CREATE SEQUENCE
andALTER SEQUENCE
pages.I intentionally did not include an example for sequence caching, as I am not sure how/that we expose cached values, through system catalogs or otherwise...
To this point,
CACHE
does not appear in theSHOW CREATE
output: