This is the mail archive of the
rhdb-explain@sourceware.org
mailing list for the RHDB project.
[Fwd: rhdb-explain-2.0 suggested modification]
- From: Renato Gini <rgini at inwind dot it>
- To: rhdb-explain at sources dot redhat dot com
- Cc: Fernando Nasser <fnasser at redhat dot com>, dbhole at redhat dot com, Andrea Gerbo <andrea dot gerbo at poste dot it>
- Date: Wed, 24 May 2006 11:31:35 +0200
- Subject: [Fwd: rhdb-explain-2.0 suggested modification]
Hi,
as suggested by Fernando Nasser, we repost our message to this e-mail
address.
We also added the version of PostgreSql we used (previously forgotten);
we will be glad to test your new version for PostgreSql v.8 when available!
Best regards
Renato Gini & Andrea Gerbo
Hello,
we are two italian developers; your tool is really great!!!
While trying to use it, we found a great loss of performances when the query has more than 1 or 2 components;
the memory was used at full and the execution time raised till we where forced to stop it by killing the process.
We made the attached modification to the source ExplainParserV73.java (using StringBuffer instead of String object) and the response is now a few seconds independently from the query complexity.
We are using Java 1.4.2_06 on a Linux (debian based) machine with PostgreSql vers.7.4
We hope our suggestion can be useful and we are available for any further question or specification.
Many thanks to you for your great work.
Renato Gini mailto:rgini@inwind.it
Andrea Gerbo mailto:andrea.gerbo@poste.it
Attachment: source modification
//ADDED
StringBuffer tmp = new StringBuffer();
// Parse the first row. Ignore all 'bad' rows.
while (rs.next())
{
// Parse the first part (the dump)
// The form of the dump is:
// .A '{'/
// <dump - may contain pairs of '{}'>
// .A '}'
// first row
str = rs.getString(1);
if (str.trim().startsWith("{"))
{
///REPLACED dump = str;/
tmp.append(str);
break;
}
else
{
System.err.println("Ignoring: " + str);
rs.next();
}
}
if (rs.isAfterLast())
throw new ExplainException("Unexpected EXPLAIN output");
// If we get here, we know that first row has the first "{"
// look for the "}" that closes the query dump
int braces = countChars(str, '{');
braces -= countChars(str, '}');
int ii=0;
while ((braces > 0) && (rs.next()))
{
str = rs.getString(1);
//REPLACED dump += "\n" + str;
tmp.append ("\n" + str);
braces += countChars(str, '{');
braces -= countChars(str, '}');
}
//ADDED
dump = tmp.toString();
if (rs.isAfterLast())
throw new ExplainException("Got nothing when QUERY PLAN expected");