From: | <mallah(at)trade-india(dot)com> |
---|---|
To: | <pgsql-admin(at)postgresql(dot)org> |
Subject: | \d tablename with psql over slow links... |
Date: | 2003-02-23 16:37:59 |
Message-ID: | 1042.219.65.235.8.1046018279.squirrel@mail.trade-india.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Hi.
The \d tablename is too slow when its comes to usage over a dialup connection.
What i observed is that psql issues a sperate set of sql for getting default
value of each attribute if it has. The number sqls increases as the
size of table increases (no of attributes).
the information abt the default values can also be got by using a subselect
in the top level query which psql does to get list of attributes.
over local/fast links it may not be significant problem , but for dial up
connections it does.
I observed that a table which used to take 16 secs with \d was only taking
6 secs if the query for default attribute values are shifted to top level query in
psql/describe.c ( function describeOneTableDetails ) .
below is the diff for describe.c
Any comments?
[root(at)subho psql]# diff -B ../safepsql/describe.c describe.c
638a639
> unsigned int defaultcol = 5;
706a709,714
>
> /* my code additions 1 */
> appendPQExpBuffer(&buf, ", (SELECT substring(adsrc for 128) FROM pg_catalog.pg_attrdef
> WHERE adrelid =%s AND adnum = a.attnum ) " , oid );> /* ends 1 */
>
>
760,768d775
< PGresult *result;
<
< printfPQExpBuffer(&buf,
< "SELECT substring(d.adsrc for
128) FROM pg_catalog.pg_attrdef d\n"< "WHERE d.adrelid = '%s' AND d.adnum = %s",
< oid, PQgetvalue(res, i, 4));
<
< result = PSQLexec(buf.data, false);
<
772d779
< strcat(cells[i * cols + 2], result ? PQgetvalue(result, 0, 0) : "?");
774c781,784
< PQclear(result);
---
> if (verbose)
> defaultcol = 6;
> strcat(cells[i * cols + 2], PQgetvalue(res, i, defaultcol ) );
>
-----------------------------------------
Get your free web based email at trade-india.com.
"India's Leading B2B eMarketplace.!"
http://www.trade-india.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2003-02-23 16:58:48 | Re: \d tablename with psql over slow links... |
Previous Message | Aspire Something | 2003-02-23 16:22:10 | Date Return must be As per Natural Calander |