Comments (1)
A simple test below shows two aspects of read committed isolation:
- Each statement in a function uses a new read point
- If and when a function execution returns control to the outer caller statement, the execution switches back to using the read point of the outer caller. In other words, read points are saved and the execution can switch between read points.
create table dummy(k int primary key, v int);
insert into dummy values (1, 1);
create table test(k int primary key, v text);
insert into test select generate_series(1,2), '';
insert into test select generate_series(101,102), '';
insert into test select generate_series(201,202), '';
insert into test select generate_series(301,302), '';
insert into test select generate_series(401,402), '';
create or replace function inner_func_volatile(n int)
returns int
language plpgsql volatile
as $body$
begin
perform pg_sleep(1);
update test set v=v || clock_timestamp() || (' Inner func stmt 1 ...' || ' v:' || (select v from dummy)) where k in (n+100, n+200);
perform pg_sleep(1);
update test set v=v || clock_timestamp() || (' Inner func stmt 2 ...' || ' v:' || (select v from dummy)) where k in (n+300, n+400);
perform pg_sleep(1);
return n;
end;
$body$;
create or replace procedure parallel_update_loop(num_times int)
language plpgsql
as $body$
begin
FOR i IN 1..num_times LOOP
update dummy set v=v+1 where k=1;
commit;
END LOOP;
end;
$body$;
S1: call parallel_update_loop(100000);
S2: update test set v=v || clock_timestamp() || (' Top level stmt ...' || ' v:' || (select v from dummy where k=1)) where inner_func_volatile(k)=k and k IN (1, 2);
S2: select * from test;
k | v
-----+----------------------------------------------------------------
101 | 2024-01-22 20:51:38.381113+05:30 Inner func stmt 1 ... v:25271
201 | 2024-01-22 20:51:38.381221+05:30 Inner func stmt 1 ... v:25271
301 | 2024-01-22 20:51:39.381978+05:30 Inner func stmt 2 ... v:28940
401 | 2024-01-22 20:51:39.382512+05:30 Inner func stmt 2 ... v:28940
1 | 2024-01-22 20:51:40.383365+05:30 Top level stmt ... v:19536
102 | 2024-01-22 20:51:41.384057+05:30 Inner func stmt 1 ... v:34041
202 | 2024-01-22 20:51:41.384383+05:30 Inner func stmt 1 ... v:34041
302 | 2024-01-22 20:51:42.384776+05:30 Inner func stmt 2 ... v:35710
402 | 2024-01-22 20:51:42.385071+05:30 Inner func stmt 2 ... v:35710
2 | 2024-01-22 20:51:43.385532+05:30 Top level stmt ... v:19536
(10 rows)
from yugabyte-db.
Related Issues (20)
- PGX RR TASK 4: Update the relevant YugabyteDB Doc section about the added feature.
- PGX RR TASK 3: Write new Tests to test the added feature to limit connection to Read Replicas.
- PGX RR TASK 1: Dev Task: Filter servers coming from `yb_servers()` based on `node_type` column.
- PGX RR TASK 2: Dev Task: Select a appropriate primary or read replica server based on load_balance and topology_keys connection parameters.
- [Docs] CDCSDK: Missing section for values without before image enabled
- PGX RR QA TASK 1: Run existing and newly added tests of PGX driver: functional, performance and Upstream Tests.
- PGX RR QA TASK 2: Run GORM and pgx-pool tests.
- Docs: Modify index creation workflow from post -> pre
- Docs: Mention in "Assess Migration" that pg_parity flag should be used while creating YB cluster
- Create github actions workflow for running sizing calculator unit tests
- Update failure reasoning to ask users to connect with YB customer support.
- [YSQL] ERROR: not an integer type after turning off Nested Loop using CTE Insert
- [DocDB] Metrics/Logs to track data read from WALs at tablet bootstrap
- [YSQL] Rollback DocDB operations on an unsuccessful ADD COLUMN/ALTER TABLE rewrite operation
- [DocDB] CDCService updates tablet-meta files periodically resulting in substantial impact on Disk IO
- [DocDB] Add gflag to control of RWCLock debug logging
- [CDCSDK] Prevent indexes & materialized views created after a CDC stream from being added to the CDC stream
- Fix the identifier regex in analyze-schema for handling all the PG identifier syntax
- [CDCSDK] Use replication slot name in stream metadata to differentiate between consumption models
- Unsupported Features of Oracle - add about table partitioning schema not supported in YB
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 yugabyte-db.