Skip to content

Commit

Permalink
Merge branch 'master' of percona.github.com:Percona-Lab/random_data_load
Browse files Browse the repository at this point in the history
  • Loading branch information
percona-csalguero committed Dec 26, 2017
2 parents 501f333 + b09e4f5 commit 4099bb2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This is an early stage project.
The program can detect if a field accepts NULLs and if it does, it will generate NULLs ramdomly (~ 10 % of the values).

## Usage
`random-data-generator <database> <table> <number of rows> [options...]`
`mysql_random_data_load <database> <table> <number of rows> [options...]`

## Options
|Option|Description|
Expand All @@ -66,7 +66,7 @@ If a field has Foreign Keys constraints, `random-data-load` will get up to `--ma
The number of samples to get follows this rules:
**1.** Get the aproximate number of rows in the referenced table using the `rows` field in:
```
EXPLAIN COUNT(*) FROM <referenced schema>.<referenced table>
EXPLAIN SELECT COUNT(*) FROM <referenced schema>.<referenced table>
```
**1.1** If the number of rows is less than `max-fk-samples`, all rows are retrieved from the referenced table using this query:
```
Expand Down Expand Up @@ -153,6 +153,20 @@ tcol28: 6.12
1 row in set (0.00 sec)
```

## How to download the precompiled binaries

There are binaries available for each version for Linux and Darwin. You can find compiled binaries for each version in the releases tab:

https://github.com/Percona-Lab/mysql_random_data_load/releases

You can copy a link for the binary you want (in this case for 1.0.5), and use wget to download:

```
cd ~/bin/
wget https://github.com/Percona-Lab/mysql_random_data_load/releases/download/0.1.5/mysql_random_data_load_linux_amd64
chmod +x mysql_random_data_load_linux_amd64
```

## To do
- [ ] Add suport for all data types.
- [X] Add supporrt for foreign keys.
Expand Down
2 changes: 1 addition & 1 deletion tableparser/tableparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type IndexField struct {
SeqInIndex int
ColumnName string
Collation sql.NullString
Cardinality int
Cardinality sql.NullInt64
SubPart sql.NullInt64
Packed sql.NullString
Null string
Expand Down

0 comments on commit 4099bb2

Please sign in to comment.