Received: from beertje.william.bogus (IDENT:root@p0986.vcu.wanadoo.nl [194.134.202.223]) by hub.org (8.10.1/8.10.1) with ESMTP id e6V8MZB11858 for ; Mon, 31 Jul 2000 04:22:36 -0400 (EDT) Received: (from williamc@localhost) by beertje.william.bogus (8.9.3/8.8.7) id KAA01439; Mon, 31 Jul 2000 10:30:00 +0200 X-Authentication-Warning: beertje.william.bogus: williamc set sender to williamc@paneris.org using -f From: William Chesters MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 31 Jul 2000 10:29:59 +0200 (CEST) To: pgsql-interfaces@postgresql.org, melati_development@messageboards.paneris.org Subject: RE: JDBC driver GREATLY speeded up by trivial fix In-Reply-To: <1B3D5E532D18D311861A00600865478CF1B184@exchange1.nt.maidstone.gov.uk> References: <1B3D5E532D18D311861A00600865478CF1B184@exchange1.nt.maidstone.gov.uk> X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid Message-ID: <14725.12859.857141.405432@beertje.william.bogus> X-Archive-Number: 200007/218 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"); }