← Back to team overview

maria-developers team mailing list archive

Re: log analyzer


Reading a bit more mariadb manual what i need is near to EXPLAIN EXTENDED +
SHOW WARNINGS, but with "?" will card instead of constants

2013/4/23 Roberto Spadim <roberto@xxxxxxxxxxxxx>

> Hi guys,
> I was looking for something that give me the 'prepared statement' of a SQL
> query
> for example:
> statment = SELECT * FROM table WHERE field="value"
> prepared statement = SELECT * FROM table WHERE field=?
> why do this? well my idea is build a log analyzer and get commong queries
> since some programs don't use native prepared statement, reading the slow
> query log, or query log only will give me many different queries
> what i want is:
> 1)read queries log
> 2)get queries
> 3)get the 'prepared statement' of the query
> 4)create a table with prepared statement / unique id (maybe md5 of
> (database name + prepared statement) )
> 5)create statistics using the unique id of prepared statement and check if
> the same 'kind' of queries are running with a mean time, or have some low
> and high times (for example) or getting information if some index is being
> used or not, well here i have many ideas but it's not the 'problem' for now
> the problem is the item (3), i have a query and i need the 'prepared
> statement' of this query, even the query was not executed with prepared
> statements
> this should work for INSERT, DELETE, UPDATE, SELECT, CREATE TABLE and
> others queries too (for now SELECT is enought, but in future others kinds
> of query will be nice)
> anyone know something that could do this job? maybe part of the mariadb
> query parser could/should be used?
> i was thinking about a command that could be executed in mariadb, today we
> have the EXPLAIN, we could have PARSE or other name?
> simplifying the problem: read the query, parse it and change constant
> values with "?" willcard
> thanks! any help is welcome
> --
> Roberto Spadim

Roberto Spadim

Follow ups