RE: JDBC driver GREATLY speeded up by trivial fix

Поиск
Список
Период
Сортировка
От William Chesters
Тема RE: JDBC driver GREATLY speeded up by trivial fix
Дата
Msg-id 14725.12859.857141.405432@beertje.william.bogus
обсуждение исходный текст
Ответ на RE: JDBC driver GREATLY speeded up by trivial fix  (Peter Mount <petermount@it.maidstone.gov.uk>)
Список pgsql-interfaces
Peter Mount writes:> As for receiveString(), it predates the driver merger (some 2 years ago?) so> as it's never broke
it'sbeen 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.relnameAS TABLE_NAME, " +         "NOT i.indisunique AS NON_UNIQUE, null AS INDEX_QUALIFIER, " +         "ti.relname
ASINDEX_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.indrelidAND " +         // 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"); }
 


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Peter Mount
Дата:
Сообщение: RE: JDBC driver GREATLY speeded up by trivial fix
Следующее
От: Peter Mount
Дата:
Сообщение: RE: JDBC driver GREATLY speeded up by trivial fix