Comments (10)
What kind of partitioning strategy are you using in this case?
from pgweb.
It's the new style "declarative" partitioning (EDIT: described here). More info:
# \d test_runs_raw
Partitioned table "public.test_runs_raw"
Column | Type | Collation | Nullable | Default
-------------------+-----------------------------+-----------+----------+----------------------------------
run_n | bigint | | not null | generated by default as identity
test_executable_n | integer | | not null |
test_function_n | integer | | not null |
test_datatag_n | integer | | |
workitem_n | integer | | not null |
started_on | timestamp without time zone | | |
duration_ms | integer | | |
test_resulttype_n | smallint | | not null |
Partition key: RANGE (workitem_n)
Indexes:
"test_runs_raw_partitioned_pkey" PRIMARY KEY, btree (workitem_n, run_n), tablespace "archival_tablespace_1"
Foreign-key constraints:
[...]
Number of partitions: 1000 (Use \d+ to list them.)
Tablespace: "tablespace1"
from pgweb.
I dont have much experience with partitioning in Postgres, do you think you can submit a PR with a test setup? Something that could emulate your use case and save me time on R&D. And just FYI, this is the file pgweb uses to lookup tables/functions/etc https://github.com/sosedoff/pgweb/blob/master/pkg/statements/sql/objects.sql - so maybe we could support partitioning with minimal changes. LMK
from pgweb.
By "test setup", would a script that prepares a partitioned table, be enough? Maybe that also populates it? Where should it be posted?
At the present time it's difficult to steal time for looking into the internals of postgres and pgweb, so a proper pull request changing the logic in objects.sql
might take time on my part.
from pgweb.
Yes, by test setup i mean a PR with instructions to create tables/partitions + bonus if they have data. You can reference a gist if you want as well, the medium does not matter much. Im pretty short on time these days too, so your best bet is to provide as much setup instructions as you can.
from pgweb.
Create the virtual (parent) table:
CREATE TABLE test_runs (
testrun_id bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
testname_id int NOT NULL,
exitcode int,
duration int,
PRIMARY KEY (testname_id, testrun_id)
) PARTITION BY RANGE (testname_id);
Create 1000 partitions to hold values of testname_id
up to 20K:
CREATE EXTENSION plpython3u;
DO $$
start = 0
fin = 20000
step = 20
for n in range(start, fin, step):
nmax = n + 20
stmt = f'''
CREATE TABLE test_runs__PART_max{nmax}
PARTITION OF test_runs
FOR VALUES FROM ({n}) TO ({nmax})
'''
plpy.info(stmt)
plpy.execute(stmt)
$$ LANGUAGE plpython3u;
To populate, we insert 1M random values that will be automatically distributed into the partitions:
INSERT INTO test_runs (testname_id, exitcode, duration)
SELECT s % 20000, round(random()), round(random()*30)
FROM generate_series(0,999999) AS s;
from pgweb.
Related Issues (20)
- No ability to edit tables etc ? HOT 1
- "error":"pg_dump command failed: ","status":400 HOT 6
- Opening a view takes forever, and maybe times out after 300s HOT 5
- Add support httpS for localhost (increased security) HOT 3
- problem a small window
- add a convenient menu for editing the table HOT 1
- upload csv/text for for a table HOT 1
- wrong duration_ms round HOT 5
- BinaryCodec default config is base64 HOT 2
- Feature request: resize query window HOT 3
- typo in bookmarks documentation? HOT 2
- Insert new rows HOT 1
- Jquery update to 3.5.0 ? HOT 1
- New docker image release HOT 2
- No bookmarks after update from docker image 0.14.0 to 0.14.1 HOT 2
- Error "sql: database is closed"
- Feature Request: Tablespaces support HOT 1
- QueryStore on database level HOT 4
- Connect multiple DB same time HOT 1
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 pgweb.