Query generator

Started by Vinicius Segalinover 9 years ago6 messagesgeneral
Jump to latest
#1Vinicius Segalin
vinisegalin@gmail.com

Hi everyone,

Does anyone know a random query generator for Postgres? Something that gets
my schema and, based on that, generates hundreds of different queries with
join, group by, etc.

Thank you.

#2Julien Rouhaud
rjuju123@gmail.com
In reply to: Vinicius Segalin (#1)
Re: Query generator

On 29/09/2016 21:27, Vinicius Segalin wrote:

Hi everyone,

Hello,

Does anyone know a random query generator for Postgres? Something that
gets my schema and, based on that, generates hundreds of different
queries with join, group by, etc.

You should try sqlsmith (https://github.com/anse1/sqlsmith), which works
very well.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Vinicius Segalin
vinisegalin@gmail.com
In reply to: Julien Rouhaud (#2)
Re: Query generator

2016-09-29 16:32 GMT-03:00 Julien Rouhaud <julien.rouhaud@dalibo.com>:

On 29/09/2016 21:27, Vinicius Segalin wrote:

Hi everyone,

Hello,

Does anyone know a random query generator for Postgres? Something that
gets my schema and, based on that, generates hundreds of different
queries with join, group by, etc.

You should try sqlsmith (https://github.com/anse1/sqlsmith), which works
very well.

I had found this one before, but all I could get was queries using
"standard" tables, like the ones from pg_catalog and information_schema. It
didn't generate queries from the tables I've created. Was I doing something
wrong?

#4Julien Rouhaud
rjuju123@gmail.com
In reply to: Vinicius Segalin (#3)
Re: Query generator

On 29/09/2016 23:23, Vinicius Segalin wrote:

2016-09-29 16:32 GMT-03:00 Julien Rouhaud <julien.rouhaud@dalibo.com
<mailto:julien.rouhaud@dalibo.com>>:
You should try sqlsmith (https://github.com/anse1/sqlsmith
<https://github.com/anse1/sqlsmith&gt;), which works
very well.

I had found this one before, but all I could get was queries using
"standard" tables, like the ones from pg_catalog and information_schema.
It didn't generate queries from the tables I've created. Was I doing
something wrong?

I don't think so, unless you specified an empty database with the
--target option. I never had this issue myself, so I can only advice you
to open an issue on the project repository if you still have this problem.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Andreas Seltenreich
seltenreich@gmx.de
In reply to: Vinicius Segalin (#3)
Re: Query generator

Vinicius Segalin <vinisegalin@gmail.com> writes:

2016-09-29 16:32 GMT-03:00 Julien Rouhaud <julien.rouhaud@dalibo.com>:

You should try sqlsmith (https://github.com/anse1/sqlsmith), which works
very well.

I had found this one before, but all I could get was queries using
"standard" tables, like the ones from pg_catalog and
information_schema. It didn't generate queries from the tables I've
created. Was I doing something wrong?

It should pick your relations with the same likelihood it picks the
catalog tables. You could verify this for with, e.g.,

sqlsmith --dry-run | grep your_table_name

Thanks to Julien, sqlsmith's master branch now has an option
--exclude-catalog that inhibits use of catalog relations. If you are
building from github, you might want to give it another chance with this
option. I'll probably do a proper release in next two weeks.

Feedback welcome :-)

regards,
Andreas

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#6Vinicius Segalin
vinisegalin@gmail.com
In reply to: Andreas Seltenreich (#5)
Re: Query generator

2016-10-16 8:54 GMT-02:00 Andreas Seltenreich <seltenreich@gmx.de>:

Vinicius Segalin <vinisegalin@gmail.com> writes:

2016-09-29 16:32 GMT-03:00 Julien Rouhaud <julien.rouhaud@dalibo.com>:

You should try sqlsmith (https://github.com/anse1/sqlsmith), which

works

very well.

I had found this one before, but all I could get was queries using
"standard" tables, like the ones from pg_catalog and
information_schema. It didn't generate queries from the tables I've
created. Was I doing something wrong?

It should pick your relations with the same likelihood it picks the
catalog tables. You could verify this for with, e.g.,

sqlsmith --dry-run | grep your_table_name

Thanks to Julien, sqlsmith's master branch now has an option
--exclude-catalog that inhibits use of catalog relations. If you are
building from github, you might want to give it another chance with this
option. I'll probably do a proper release in next two weeks.

Feedback welcome :-)

regards,
Andreas

Yes, I was talking in private with him and he came up with this solution.
Thank you again, Julien.
I need to try it again, did a quick test on friday, but it looks like it
works perfectly! :)