All Downloads are FREE. Search and download functionalities are using the official Maven repository.

activities.postgres-basic.yaml Maven / Gradle / Ivy

There is a newer version: 4.15.102
Show newest version
# java -jar nb.jar run driver=cockroachdb workload=postgres-basic tags=phase:rampup cycles=10 \
#   serverName=localhost databaseName=bank
# java -jar nb.jar run driver=cockroachdb workload=postgres-basic tags=phase:main cycles=10 serverName=localhost
description: An example of a basic postgres bank transaction workload

scenarios:
  default:
    - run driver===cockroachdb tags===phase:main threads=auto cycles=10000000
      serverName=localhost portNumber=5432 databaseName=<> user=postgres
      password=postgres connectionpool=hikari
      errors=SQLTransient.*:warn,count,retry;.*0800.*:warn,count,retry;stop
  rampup:
    - run driver===cockroachdb tags===phase:rampup threads=auto cycles=<>
      serverName=localhost portNumber=5432 databaseName=<> user=postgres
      password=postgres connectionpool=hikari filler-binding="AlphaNumericString(10)"
      errors=SQLTransient.*:warn,count,retry;.*0800.*:warn,count,retry;stop
  rampup-large:
    - run driver===cockroachdb tags===phase:rampup threads=auto cycles=<>
      serverName=localhost portNumber=5432 databaseName=<> user=postgres
      password=postgres connectionpool=hikari
      errors=SQLTransient.*:warn,count,retry;.*0800.*:warn,count,retry;stop
  schema:
    - run driver===cockroachdb tags===phase:schema threads===1 serverName=localhost portNumber=5432
      databaseName=bank user=postgres password=postgres

bindings:
  seq_uuid: Mod(<>L); ToHashedUUID()
  rand_uuid: Uniform(0,<>L); ToHashedUUID()
  rand_amount: Poisson(2000000); ToInt()
  timestamp: StartingEpochMillis('2018-01-01 00:00:00'); ToDateTime()
  filler: <>; ToString()

blocks:
  - name: schema
    tags:
      phase: schema
    params:
    statements:
      - create-table: |
          CREATE TABLE IF NOT EXISTS "<>" (
            uuid UUID PRIMARY KEY,
            amount INTEGER,
            amount_unit VARCHAR(64),
            updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
            created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
            filler TEXT
          );
        tags:
          name: create-table
      - create-indices: |
          CREATE INDEX IF NOT EXISTS amount_idx on "<>" (amount);
          CREATE INDEX IF NOT EXISTS updated_at_idx on "<>" (updated_at);
        tags:
          name: create-indices
  - name: rampup
    tags:
      phase: rampup
    params:
    statements:
      - rampup-insert: |
          INSERT INTO "<>" (uuid, amount, amount_unit, updated_at, created_at, filler)
          VALUES ('{seq_uuid}', {rand_amount}, 'us_cents', '{timestamp}', '{timestamp}', '{filler}')
          ON CONFLICT DO NOTHING;
        params:
        tags:
          name: rampup-insert
  - name: main-read
    tags:
      phase: main
      type: read
    params:
      ratio: <>
    statements:
      - main-find: |
          SELECT * FROM "<>" WHERE uuid = '{rand_uuid}';
        params:
        tags:
          name: main-find
  - name: main-write
    tags:
      phase: main
      type: write
    params:
      ratio: <>
    statements:
      - main-insert: |
          UPDATE "<>" SET amount = {rand_amount}, updated_at = '{timestamp}' WHERE uuid = '{rand_uuid}';
        params:
        tags:
          name: main-insert




© 2015 - 2024 Weber Informatics LLC | Privacy Policy