From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Asif Rehman <asifr(dot)rehman(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pgbench - allow to create partitioned tables |
Date: | 2019-09-14 11:43:05 |
Message-ID: | CAA4eK1LAMB82EJDNgF9y5kUphov=egzhjb9D3kNKwA5rk4VGMg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 13, 2019 at 11:06 PM Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
>
> Hello Amit,
>
> >>> + res = PQexec(con,
> >>> + "select p.partstrat, count(*) "
> >>> + "from pg_catalog.pg_class as c "
> >>> + "left join pg_catalog.pg_partitioned_table as p on (p.partrelid = c.oid) "
> >>> + "left join pg_catalog.pg_inherits as i on (c.oid = i.inhparent) "
> >>> + "where c.relname = 'pgbench_accounts' "
> >>> + "group by 1, c.oid");
> >>>
> >>> Can't we write this query with inner join instead of left join? What
> >>> additional purpose you are trying to serve by using left join?
> >>
> >> I'm ensuring that there is always a one line answer, whether it is
> >> partitioned or not. Maybe the count(*) should be count(something in p) to
> >> get 0 instead of 1 on non partitioned tables, though, but this is hidden
> >> in the display anyway.
> >
> > Sure, but I feel the code will be simplified. I see no reason for
> > using left join here.
>
> Without a left join, the query result is empty if there are no partitions,
> whereas there is one line with it. This fact simplifies managing the query
> result afterwards because we are always expecting 1 row in the "normal"
> case, whether partitioned or not.
>
Why can't we change it as attached? I find using left join to always
get one row as an ugly way to manipulate the results later. We
shouldn't go in that direction unless we can't handle this with some
simple code.
Some more comments:
*
- '--initialize --init-steps=dtpvg --scale=1 --unlogged-tables
--fillfactor=98 --foreign-keys --quiet --tablespace=pg_default
--index-tablespace=pg_default',
+ '--initialize --init-steps=dtpvg --scale=1 --unlogged-tables
--fillfactor=98 --foreign-keys --quiet
--tablespace=regress_pgbench_tap_1_ts
--index-tablespace=regress_pgbench_tap_1_ts --partitions=2
--partition-method=hash',
What is the need of using regress_pgbench_tap_1_ts in this test? I
think we don't need to change existing tests unless required for the
new functionality.
*
- 'pgbench scale 1 initialization');
+ 'pgbench scale 1 initialization with options');
Similar to the above, it is not clear to me why we need to change this?
*pgbench(
-
# given the expected rate and the 2 ms tx duration, at most one is executed
'-t 10 --rate=100000 --latency-limit=1 -n -r',
0,
The above appears to be a spurious line change.
* I think we need to change the docs [1] to indicate the new step for
partitioning. See section --init-steps=init_steps
[1] - https://www.postgresql.org/docs/devel/pgbench.html
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
delta-pgbench-init-partitioned-7.patch | application/octet-stream | 2.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2019-09-14 12:04:25 | Re: [PATCH] Improve performance of NOTIFY over many databases (v2) |
Previous Message | Michael Paquier | 2019-09-14 09:30:02 | Re: [HACKERS] [PATCH] pageinspect function to decode infomasks |