RE: JDBC driver GREATLY speeded up by trivial fix

Поиск
Список
Период
Сортировка
От Peter Mount
Тема RE: JDBC driver GREATLY speeded up by trivial fix
Дата
Msg-id 1B3D5E532D18D311861A00600865478CF1B18A@exchange1.nt.maidstone.gov.uk
обсуждение исходный текст
Ответ на JDBC driver GREATLY speeded up by trivial fix  (William Chesters <williamc@paneris.org>)
Список pgsql-interfaces
You'll need to ask the hermit for CVS access ;-)

Peter

--
Peter Mount
Enterprise Support
Maidstone Borough Council
Any views stated are my own, and not those of Maidstone Borough Council


-----Original Message-----
From: William Chesters [mailto:williamc@paneris.org]
Sent: Monday, July 31, 2000 9:30 AM
To: pgsql-interfaces@postgresql.org;
melati_development@messageboards.paneris.org
Subject: RE: [INTERFACES] JDBC driver GREATLY speeded up by trivial fix


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
sitdown 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 AS INDEX_NAME, " +
tableIndexOther+ " AS TYPE, " +         "i.indkey[0] AS ORDINAL_POSITION, a.attname AS COLUMN_NAME, " +         "NULL
ASASC_OR_DESC, 0 AS CARDINALITY, 0 AS PAGES, " +         "NULL AS FILTER_CONDITION " +       "FROM " +
"pg_indexi, pg_class ti, pg_class t, pg_attribute a " +       "WHERE " +         "ti.oid = i.indexrelid AND t.oid =
i.indrelidAND " +         (table == null ?            "" :            "t.relname = '" + StringUtils.escaped(table,
'\'')+ "' AND ")
 
+         (unique ? "i.indisunique AND " : "") +         "a.attrelid = i.indrelid AND " +         // this strange
littleconstruct 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.Driv
er").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 по дате отправления:

Предыдущее
От: William Chesters
Дата:
Сообщение: RE: JDBC driver GREATLY speeded up by trivial fix
Следующее
От: Cedar Cox
Дата:
Сообщение: PGAccess and UNIX sockets