On Wed, Sep 11, 2019 at 6:08 PM Fabien COELHO <coe...@cri.ensmp.fr> wrote: > >
I would like to take inputs from others as well for the display part of this patch. After this patch, for a simple-update pgbench test, the changed output will be as follows (note: partition method and partitions): pgbench.exe -c 4 -j 4 -T 10 -N postgres starting vacuum...end. transaction type: <builtin: simple update> scaling factor: 1 partition method: hash partitions: 3 query mode: simple number of clients: 4 number of threads: 4 duration: 10 s number of transactions actually processed: 14563 latency average = 2.749 ms tps = 1454.899150 (including connections establishing) tps = 1466.689412 (excluding connections establishing) What do others think about this? This will be the case when the user has used --partitions option in pgbench, otherwise, it won't change. > > > + case 11: /* partitions */ > > + initialization_option_set = true; > > + partitions = atoi(optarg); > > + if (partitions < 0) > > + { > > + fprintf(stderr, "invalid number of partitions: \"%s\"\n", > > + optarg); > > + exit(1); > > + } > > + break; > > > > Is there a reason why we treat "partitions = 0" as a valid value? > > Yes. It is an explicit "do not create partitioned tables", which differ > from 1 which says "create a partitionned table with just one partition". > Why would anyone want to use --partitions option in the first case ("do not create partitioned tables")? > > > I think we should print the information about partitions in > > printResults. It can help users while analyzing results. > > Hmmm. Why not, with some hocus-pocus to get the information out of > pg_catalog, and trying to fail gracefully so that if pgbench is run > against a no partitioning-support version. > + 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? > > * > > +enum { PART_NONE, PART_RANGE, PART_HASH } > > + partition_method = PART_NONE; > > + > > > > I think it is better to follow the style of QueryMode enum by using > > typedef here, that will make look code in sync with nearby code. > > Hmmm. Why not. This means inventing a used-once type name for > partition_method. My great creativity lead to partition_method_t. > +partition_method_t partition_method = PART_NONE; It is better to make this static. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com