From: William Chesters <williamc@paneris.org>
To: pgsql-interfaces@postgresql.org
To: melati_development@messageboards.paneris.org
Subject: RE: JDBC driver GREATLY speeded up by trivial fix
Date: Mon, 31 Jul 2000 10:29:59 +0200 (CEST)
Message-ID: <14725.12859.857141.405432@beertje.william.bogus> (raw)
In-Reply-To: <1B3D5E532D18D311861A00600865478CF1B184@exchange1.nt.maidstone.gov.uk>
References: <1B3D5E532D18D311861A00600865478CF1B184@exchange1.nt.maidstone.gov.uk>
Peter Mount writes:
> As for receiveString(), it predates the driver merger (some 2 years ago?) so
> as it's never broke it's been left. I suspect there's a lot of little
> performace gems in there if we had time to sit down and do them.
Well, nothing else really leaps out the profiling data. It looks like
the effect of further improvements will be relatively marginal
compared with the unavoidable time spent on socket reads/writes, and
of course waiting for the backend to do its stuff.
> I'm currently having horrible problems with my home system (hasn't recovered
> well after the move)
sympathy ...
If you gave me a CVS p/w I could apply the ReceiveString fix and my
private fix for getTimestamp??
By the way, I've also got a rough implementation of
DatabaseMetaData.getIndexInfo---appended, with test harness---which
certainly does something, whether the JDBC-ly correct thing I don't
know!
Thanks,
William
public java.sql.ResultSet getIndexInfo(String catalog, String schema,
String table, boolean unique,
boolean approximate)
throws java.sql.SQLException {
return ((Connection)getConnection()).ExecSQL(
"SELECT " +
"null AS TABLE_CAT, null AS TABLE_SCHEMA, t.relname AS TABLE_NAME, " +
"NOT i.indisunique AS NON_UNIQUE, null AS INDEX_QUALIFIER, " +
"ti.relname AS INDEX_NAME, " + tableIndexOther + " AS TYPE, " +
"i.indkey[0] AS ORDINAL_POSITION, a.attname AS COLUMN_NAME, " +
"NULL AS ASC_OR_DESC, 0 AS CARDINALITY, 0 AS PAGES, " +
"NULL AS FILTER_CONDITION " +
"FROM " +
"pg_index i, pg_class ti, pg_class t, pg_attribute a " +
"WHERE " +
"ti.oid = i.indexrelid AND t.oid = i.indrelid AND " +
(table == null ?
"" :
"t.relname = '" + StringUtils.escaped(table, '\'') + "' AND ") +
(unique ? "i.indisunique AND " : "") +
"a.attrelid = i.indrelid AND " +
// this strange little construct is needed because
// `a.attnum = i.indkey[0]' causes 6.4.2 (at least) to fail, losing
// connection to backend:
"a.attnum - i.indkey[0] = 0");
}
public static void main(String[] args) throws Exception {
java.sql.DriverManager.registerDriver((Driver)Class.forName("postgresql.Driver").newInstance());
java.sql.Connection c = java.sql.DriverManager.getConnection("jdbc:postgresql:" + args[0], "postgres", "*");
java.sql.DatabaseMetaData m = c.getMetaData();
java.sql.ResultSet inds = m.getIndexInfo(null, "", args[1], false, true);
while (inds.next())
System.out.println("TABLE_CAT " + inds.getString("TABLE_CAT") + "\n" +
"TABLE_SCHEMA " + inds.getString("TABLE_SCHEMA") + "\n" +
"TABLE_NAME " + inds.getString("TABLE_NAME") + "\n" +
"NON_UNIQUE " + inds.getBoolean("NON_UNIQUE") + "\n" +
"INDEX_QUALIFIER " + inds.getString("INDEX_QUALIFIER") + "\n" +
"INDEX_NAME " + inds.getString("INDEX_NAME") + "\n" +
"TYPE " + inds.getShort("TYPE") + "\n" +
"ORDINAL_POSITION " + inds.getShort("ORDINAL_POSITION") + "\n" +
"COLUMN_NAME " + inds.getString("COLUMN_NAME") + "\n" +
"ASC_OR_DESC " + inds.getString("ASC_OR_DESC") + "\n" +
"CARDINALITY " + inds.getInt("CARDINALITY") + "\n" +
"PAGES " + inds.getInt("PAGES") + "\n" +
"FILTER_CONDITION " + inds.getString("FILTER_CONDITION") + "\n");
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: williamc@paneris.org, melati_development@messageboards.paneris.org
Subject: RE: JDBC driver GREATLY speeded up by trivial fix
In-Reply-To: <14725.12859.857141.405432@beertje.william.bogus>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox