mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 08:32:02 +00:00
Merge pull request #65974 from Blargian/transaction_xyz
[Docs] add `transactionID`, `transactionLatestSnapshot`, `transactionOldestSnapshot`
This commit is contained in:
commit
e0ff544bd0
@ -3860,3 +3860,138 @@ Result:
|
||||
└───────────────┘
|
||||
```
|
||||
|
||||
## transactionID
|
||||
|
||||
Returns the ID of a [transaction](https://clickhouse.com/docs/en/guides/developer/transactional#transactions-commit-and-rollback).
|
||||
|
||||
:::note
|
||||
This function is part of an experimental feature set. Enable experimental transaction support by adding this setting to your configuration:
|
||||
|
||||
```
|
||||
<clickhouse>
|
||||
<allow_experimental_transactions>1</allow_experimental_transactions>
|
||||
</clickhouse>
|
||||
```
|
||||
|
||||
For more information see the page [Transactional (ACID) support](https://clickhouse.com/docs/en/guides/developer/transactional#transactions-commit-and-rollback).
|
||||
:::
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
transactionID()
|
||||
```
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns a tuple consisting of `start_csn`, `local_tid` and `host_id`. [Tuple](../data-types/tuple.md).
|
||||
|
||||
- `start_csn`: Global sequential number, the newest commit timestamp that was seen when this transaction began. [UInt64](../data-types/int-uint.md).
|
||||
- `local_tid`: Local sequential number that is unique for each transaction started by this host within a specific start_csn. [UInt64](../data-types/int-uint.md).
|
||||
- `host_id`: UUID of the host that has started this transaction. [UUID](../data-types/uuid.md).
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
BEGIN TRANSACTION;
|
||||
SELECT transactionID();
|
||||
ROLLBACK;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```response
|
||||
┌─transactionID()────────────────────────────────┐
|
||||
│ (32,34,'0ee8b069-f2bb-4748-9eae-069c85b5252b') │
|
||||
└────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## transactionLatestSnapshot
|
||||
|
||||
Returns the newest snapshot (Commit Sequence Number) of a [transaction](https://clickhouse.com/docs/en/guides/developer/transactional#transactions-commit-and-rollback) that is available for reading.
|
||||
|
||||
:::note
|
||||
This function is part of an experimental feature set. Enable experimental transaction support by adding this setting to your configuration:
|
||||
|
||||
```
|
||||
<clickhouse>
|
||||
<allow_experimental_transactions>1</allow_experimental_transactions>
|
||||
</clickhouse>
|
||||
```
|
||||
|
||||
For more information see the page [Transactional (ACID) support](https://clickhouse.com/docs/en/guides/developer/transactional#transactions-commit-and-rollback).
|
||||
:::
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
transactionLatestSnapshot()
|
||||
```
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns the latest snapshot (CSN) of a transaction. [UInt64](../data-types/int-uint.md)
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
BEGIN TRANSACTION;
|
||||
SELECT transactionLatestSnapshot();
|
||||
ROLLBACK;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```response
|
||||
┌─transactionLatestSnapshot()─┐
|
||||
│ 32 │
|
||||
└─────────────────────────────┘
|
||||
```
|
||||
|
||||
## transactionOldestSnapshot
|
||||
|
||||
Returns the oldest snapshot (Commit Sequence Number) that is visible for some running [transaction](https://clickhouse.com/docs/en/guides/developer/transactional#transactions-commit-and-rollback).
|
||||
|
||||
:::note
|
||||
This function is part of an experimental feature set. Enable experimental transaction support by adding this setting to your configuration:
|
||||
|
||||
```
|
||||
<clickhouse>
|
||||
<allow_experimental_transactions>1</allow_experimental_transactions>
|
||||
</clickhouse>
|
||||
```
|
||||
|
||||
For more information see the page [Transactional (ACID) support](https://clickhouse.com/docs/en/guides/developer/transactional#transactions-commit-and-rollback).
|
||||
:::
|
||||
|
||||
**Syntax**
|
||||
|
||||
```sql
|
||||
transactionOldestSnapshot()
|
||||
```
|
||||
|
||||
**Returned value**
|
||||
|
||||
- Returns the oldest snapshot (CSN) of a transaction. [UInt64](../data-types/int-uint.md)
|
||||
|
||||
**Example**
|
||||
|
||||
Query:
|
||||
|
||||
```sql
|
||||
BEGIN TRANSACTION;
|
||||
SELECT transactionLatestSnapshot();
|
||||
ROLLBACK;
|
||||
```
|
||||
|
||||
Result:
|
||||
|
||||
```response
|
||||
┌─transactionOldestSnapshot()─┐
|
||||
│ 32 │
|
||||
└─────────────────────────────┘
|
||||
```
|
||||
|
@ -48,7 +48,6 @@ AutoML
|
||||
Autocompletion
|
||||
AvroConfluent
|
||||
BIGINT
|
||||
bigrams
|
||||
BIGSERIAL
|
||||
BORO
|
||||
BSON
|
||||
@ -223,7 +222,6 @@ DatabaseOrdinaryThreadsActive
|
||||
DateTime
|
||||
DateTimes
|
||||
DbCL
|
||||
deallocated
|
||||
Decrypted
|
||||
Deduplicate
|
||||
Deduplication
|
||||
@ -295,7 +293,6 @@ FilesystemMainPathUsedBytes
|
||||
FilesystemMainPathUsedINodes
|
||||
FixedString
|
||||
FlameGraph
|
||||
flameGraph
|
||||
Flink
|
||||
ForEach
|
||||
FreeBSD
|
||||
@ -995,6 +992,8 @@ UPDATEs
|
||||
URIs
|
||||
URL
|
||||
URL's
|
||||
URLDecode
|
||||
URLEncode
|
||||
URLHash
|
||||
URLHierarchy
|
||||
URLPathHierarchy
|
||||
@ -1012,13 +1011,10 @@ UncompressedCacheBytes
|
||||
UncompressedCacheCells
|
||||
UnidirectionalEdgeIsValid
|
||||
UniqThetaSketch
|
||||
unigrams
|
||||
Updatable
|
||||
Uppercased
|
||||
Uptime
|
||||
Uptrace
|
||||
URLDecode
|
||||
URLEncode
|
||||
UserID
|
||||
Util
|
||||
VARCHAR
|
||||
@ -1224,6 +1220,7 @@ basename
|
||||
bcrypt
|
||||
benchmarking
|
||||
bfloat
|
||||
bigrams
|
||||
binlog
|
||||
bitAnd
|
||||
bitCount
|
||||
@ -1473,6 +1470,7 @@ dbeaver
|
||||
dbgen
|
||||
dbms
|
||||
ddl
|
||||
deallocated
|
||||
deallocation
|
||||
deallocations
|
||||
debian
|
||||
@ -1512,11 +1510,11 @@ deserializing
|
||||
destructor
|
||||
destructors
|
||||
detectCharset
|
||||
detectTonality
|
||||
detectLanguage
|
||||
detectLanguageMixed
|
||||
detectLanguageUnknown
|
||||
detectProgrammingLanguage
|
||||
detectTonality
|
||||
determinator
|
||||
deterministically
|
||||
dictGet
|
||||
@ -1532,8 +1530,8 @@ dictIsIn
|
||||
disableProtocols
|
||||
disjunction
|
||||
disjunctions
|
||||
displaySecretsInShowAndSelect
|
||||
displayName
|
||||
displaySecretsInShowAndSelect
|
||||
distro
|
||||
divideDecimal
|
||||
dmesg
|
||||
@ -1583,11 +1581,11 @@ evalMLMethod
|
||||
exFAT
|
||||
expiryMsec
|
||||
exponentialMovingAverage
|
||||
exponentialmovingaverage
|
||||
exponentialTimeDecayedAvg
|
||||
exponentialTimeDecayedCount
|
||||
exponentialTimeDecayedMax
|
||||
exponentialTimeDecayedSum
|
||||
exponentialmovingaverage
|
||||
expr
|
||||
exprN
|
||||
extendedVerification
|
||||
@ -1624,6 +1622,7 @@ firstSignificantSubdomainCustom
|
||||
firstSignificantSubdomainCustomRFC
|
||||
firstSignificantSubdomainRFC
|
||||
fixedstring
|
||||
flameGraph
|
||||
flamegraph
|
||||
flatbuffers
|
||||
flattenTuple
|
||||
@ -1806,8 +1805,8 @@ incrementing
|
||||
indexHint
|
||||
indexOf
|
||||
infi
|
||||
infty
|
||||
inflight
|
||||
infty
|
||||
initcap
|
||||
initcapUTF
|
||||
initialQueryID
|
||||
@ -1955,9 +1954,9 @@ loghouse
|
||||
london
|
||||
lookups
|
||||
loongarch
|
||||
lowcardinality
|
||||
lowCardinalityIndices
|
||||
lowCardinalityKeys
|
||||
lowcardinality
|
||||
lowerUTF
|
||||
lowercased
|
||||
lttb
|
||||
@ -2265,9 +2264,9 @@ proleptic
|
||||
prometheus
|
||||
proportionsZTest
|
||||
proto
|
||||
protocol
|
||||
protobuf
|
||||
protobufsingle
|
||||
protocol
|
||||
proxied
|
||||
pseudorandom
|
||||
pseudorandomize
|
||||
@ -2759,6 +2758,9 @@ topLevelDomain
|
||||
topLevelDomainRFC
|
||||
topk
|
||||
topkweighted
|
||||
transactionID
|
||||
transactionLatestSnapshot
|
||||
transactionOldestSnapshot
|
||||
transactional
|
||||
transactionally
|
||||
translateUTF
|
||||
@ -2812,6 +2814,7 @@ unescaping
|
||||
unhex
|
||||
unicode
|
||||
unidimensional
|
||||
unigrams
|
||||
unintuitive
|
||||
uniq
|
||||
uniqCombined
|
||||
|
Loading…
Reference in New Issue
Block a user