public inbox for rhdb-explain@sourceware.org
 help / color / mirror / Atom feed
From: Renato Gini <rgini@inwind.it>
To: rhdb-explain@sources.redhat.com
Cc: Fernando Nasser <fnasser@redhat.com>,
	 dbhole@redhat.com,   Andrea Gerbo <andrea.gerbo@poste.it>
Subject: [Fwd: rhdb-explain-2.0 suggested modification]
Date: Wed, 24 May 2006 09:31:00 -0000	[thread overview]
Message-ID: <447427F7.8060005@inwind.it> (raw)

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");



                 reply	other threads:[~2006-05-24  9:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=447427F7.8060005@inwind.it \
    --to=rgini@inwind.it \
    --cc=andrea.gerbo@poste.it \
    --cc=dbhole@redhat.com \
    --cc=fnasser@redhat.com \
    --cc=rhdb-explain@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).