Comments (2)
The corresponding setseed
function seems non-trivial. Note the following query is actually deterministic:
test=# select case n when 1 then setseed(0.4) else null end, random() from generate_series(1, 10) as t(n);
case | random
------+---------------------
| 0.6722690410337004
| 0.9936586191615264
| 0.19947461195735405
| 0.90340354600701
| 0.516998156895498
| 0.7913052710048887
| 0.531550972556847
| 0.48302401286537666
| 0.14525565255427209
| 0.19221106009513123
(10 rows)
So what random()
really does in PostgreSQL is mutating a session-level variable:
https://www.postgresql.org/docs/16/sql-set.html#:~:text=TO%20value.-,SEED,-Sets%20the%20internal
https://github.com/postgres/postgres/blob/REL_16_1/src/backend/utils/misc/guc_tables.c#L3695-L3704
https://github.com/postgres/postgres/blob/REL_16_1/src/common/pg_prng.c#L232-L234
Of course we can provide a weaker random()
function first without the ability to generate deterministic sequence given a seed.
cc @wangrunji0408 may be more familiar with RNGs given experience working on madsim.
from risingwave.
So what random() really does in PostgreSQL is mutating a session-level variable:
Of course we can provide a weaker random() function first without the ability to generate deterministic sequence given a seed.
Either LGTM. If the session-level variable approach involves lots of work, I will prefer the 2nd
from risingwave.
Related Issues (20)
- Let join amplification logs be configurable
- Bug: Some system table's data can be queried across different database
- UPDATE statements with string literal from of the same column fails
- bug(postgres-cdc): Debezium cannot handle early timestamp HOT 2
- ci: speed up e2e test
- Refactor: rewrite CDC connector validation to Rust HOT 9
- ci/risedev: use cp-kafka to start kafka
- cherrypick feat: add barrier align metrics for merge executor (#16898) to branch release-1.9
- risedev: support configure RUST_LOG in profile
- risedev: retain old log when starting new cluster
- ci: cache mvn repository in "build other components"
- Single node mode resume from suspend fails
- Allow kafka sink to encode as PLAIN AVRO HOT 2
- nightly-20240523 backfill create mv latency perf degradation HOT 1
- cherrypick feat(storage): only update related read version on flush finish (#16725) to branch release-1.9
- feat(metrics): export block cache efficiency in Grafana
- Offer advice when ` Window function with empty PARTITION BY is not supported yet` HOT 1
- Monitor opendal streaming uploader and deprecate the outer MonitoredSteramingUploader
- test: better organize source test with different encodings
- `build risingwave release binary` fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from risingwave.