I'm not sure about MySQL, but with Oracle, you can do miracles inside
of grid control, trying to find bottlenecks and inefficiencies. But
that's database business, not data layer abstraction business...
I suggest for now, you stay with parsing log files, or you find actual
SQL analysers for MySQL. Or you create a delegate jdbc Connection and
PreparedStatement, that intercepts the execution of queries and does
the analysis for you
2011/5/17 FractalizeR <Fract...@yandex.ru>:
But what I don't understand: Why do you need a listener of the type
onExecute(), that will be executed, well, pretty much after you call
execute() anyway? Can you please list a couple of interesting use
cases, which you mentioned?
> I also share your concern about automatic query reconstruction, but
> shard-query seems to be a more or less mature project, which was tested by
> Percona:
>
> http://www.mysqlperformanceblog.com/2011/05/06/scale-out-mysql/
> http://www.mysqlperformanceblog.com/2011/05/14/distributed-set-processing-with-shard-query/
>
> And I really respect those guys and I don't think they would waste time to
> test rubbish.
I don't doubt that. However, I'm a bit spoiled with my Oracle 10g/11g
cost based optimiser that does these things automatically for me. As
soon as I partition a table, Oracle starts parallelising queries
automatically (by transforming filters into unions, etc). I think
that's the way it should be done.
Once a query has been properly attached, it can indeed communicate
execution to other listeners... I'll sleep over it
I've given this some more thought, and I finally came to the
conclusion that I could make this a feature along with my plans to
generalise logging:
http://sourceforge.net/apps/trac/jooq/ticket/139
My original plans were to have a generic logging interface with a
default implementation (binding to SLF4J). Users can override that
implementation and hook into jOOQ in order to intercept all logging
events. With your suggestions, the logging events could contain
QueryParts and Stores instead of plain strings, such that client code
has more information about what's going on.
In the end, I think you are right. There are quite a few interesting
use cases not directly related to jOOQ itself, but to SQL profiling
and tracing. Let's see if this can make it in 1.6.x
Cheers
Lukas
2011/5/17 Lukas Eder <lukas...@gmail.com>:
Can you please list a couple of interesting use cases, which you mentioned?
Oracle starts parallelising queries automatically (by transforming filters into unions, etc). I think that's the way it should be done.
You should've read my subsequente mails... ;-)
> [...] sometimes works really slow. But only sometimes. Well, you can
> just enable your own profiler listener in jooq via configuration file and it
> will magically log all queries, that execute longer than X seconds [...]
I've seen this use case, too.
> [...] but I would prefer to spare
> myself a nightmare of explaining how to install and operate them to the
> customer.
That's a good point.
> For example, I would like to implement soft delete functionality into
> software. Jooq filter can be used to add WHERE predicate on "deleted" field
> to all queries for this. It can do this correctly,only if it has access to
> jooq query model.
That, I don't understand. Can you give an example?
> Another example can be a plugin "number of thread edits" to a forum
> software. It can automatically add edited=edited+1 to all update queries on
> a particular table.
Why not use a trigger?
> Of course, you need to plan the architecture of your
> software so that it would be possible to add all those using another way,
> but you can't have too many ways, can you? :)
I think it might work along with the further logging abstraction
plans, I had previously mentioned.
> Well, if you need some more, I can think of plenty ;)
Sure. The more use cases, the better and more general the API.
> Well, I'm MySQL guy and I'm scared of even thinking of administering such a
> monster as Oracle ;)
Me too.
> Let alone it's huge price which leaves real sharding
> available only to Rockfeller-like fellows. There are a plenty other
> databases each of it has it's own way of development. And I doubt Oracle
> should set standards of how dabatase should work. Look at Facebook or some
> other large things.
On the other hand, many of them have copied from Oracle... But let's
omit this discussion ;-)