Lists: | pgsql-hackerspgsql-patches |
---|
From: | "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | psql: \d+ show tablespace of indices |
Date: | 2005-05-23 10:52:43 |
Message-ID: | d6scof$1661$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Now \d+ is able to show the tablespace details of indices. A sample output
is followed:
test=# \d+ m
Table "public.m"
Column | Type | Modifiers | Description
--------+---------+-----------+-------------
i | integer | |
j | integer | |
Indexes:
"mi" btree (i) - Tablespace: "testspace"
"mj" btree (j)
Has OIDs: no
Index: describe.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/psql/describe.c,v
retrieving revision 1.115
diff -c -r1.115 describe.c
*** describe.c 6 Apr 2005 05:23:32 -0000 1.115
--- describe.c 23 May 2005 10:41:48 -0000
***************
*** 37,43 ****
const char *schemavar, const char *namevar,
const char *altnamevar, const char *visibilityrule);
! static void add_tablespace_footer(char relkind, Oid tablespace,
char **footers, int *count, PQExpBufferData buf);
/*----------------
--- 37,43 ----
const char *schemavar, const char *namevar,
const char *altnamevar, const char *visibilityrule);
! static bool add_tablespace_footer(char relkind, Oid tablespace,
char **footers, int *count, PQExpBufferData buf);
/*----------------
***************
*** 1022,1028 ****
{
printfPQExpBuffer(&buf,
"SELECT c2.relname, i.indisprimary, i.indisunique,
i.indisclustered, "
! "pg_catalog.pg_get_indexdef(i.indexrelid, 0, true)\n"
"FROM pg_catalog.pg_class c, pg_catalog.pg_class c2,
pg_catalog.pg_index i\n"
"WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid =
c2.oid\n"
"ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname",
--- 1022,1028 ----
{
printfPQExpBuffer(&buf,
"SELECT c2.relname, i.indisprimary, i.indisunique,
i.indisclustered, "
! "pg_catalog.pg_get_indexdef(i.indexrelid, 0, true),
c2.reltablespace\n"
"FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.p
g_index i\n"
"WHERE c.oid = '%s' AND c.oid = i.indrelid AND i.indexrelid =
c2.oid\n"
"ORDER BY i.indisprimary DESC, i.indisunique DESC, c2.relname",
***************
*** 1165,1170 ****
--- 1165,1190 ----
if (strcmp(PQgetvalue(result1, i, 3), "t") == 0)
appendPQExpBuffer(&buf, " CLUSTER");
+ /* Print tablespace of the index on the same line */
+ if (verbose)
+ {
+ PQExpBufferData tmpbuf;
+
+ count_footers += 1;
+ initPQExpBuffer(&tmpbuf);
+ if (add_tablespace_footer('i', atoi(PQgetvalue(result1, i, 5)),
+ footers, &count_footers, tmpbuf))
+ {
+ appendPQExpBuffer(&buf, " - ");
+ appendPQExpBuffer(&buf, tmpbuf.data);
+
+ count_footers -= 2;
+ }
+ else
+ count_footers -= 1;
+ termPQExpBuffer(&tmpbuf);
+ }
+
footers[count_footers++] = pg_strdup(buf.data);
}
}
***************
*** 1316,1323 ****
return retval;
}
!
! static void
add_tablespace_footer(char relkind, Oid tablespace, char **footers,
int *count, PQExpBufferData buf)
{
--- 1336,1343 ----
return retval;
}
! /* Return true if the relation uses non default tablespace; otherwise
return false */
! static bool
add_tablespace_footer(char relkind, Oid tablespace, char **footers,
int *count, PQExpBufferData buf)
{
***************
*** 1336,1342 ****
"WHERE oid = '%u';", tablespace);
result1 = PSQLexec(buf.data, false);
if (!result1)
! return;
/* Should always be the case, but.... */
if (PQntuples(result1) > 0)
{
--- 1356,1362 ----
"WHERE oid = '%u';", tablespace);
result1 = PSQLexec(buf.data, false);
if (!result1)
! return false;
/* Should always be the case, but.... */
if (PQntuples(result1) > 0)
{
***************
*** 1345,1352 ****
--- 1365,1376 ----
footers[(*count)++] = pg_strdup(buf.data);
}
PQclear(result1);
+
+ return true;
}
}
+
+ return false;
}
/*
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-03 01:25:06 |
Message-ID: | 1117761906.22984.28.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
On Mon, 2005-05-23 at 18:52 +0800, Qingqing Zhou wrote:
> Now \d+ is able to show the tablespace details of indices.
Should this be included in \d? Tablespace information for the table
itself is, so I think we should probably do the same for indexes.
Also, can you resend the patch as an attachment? Perhaps the ML software
munged your email or my MUA is just broken, but the patch you sent seems
to be corrupted.
-Neil
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-03 02:15:55 |
Message-ID: | 29819.1117764955@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Neil Conway <neilc(at)samurai(dot)com> writes:
> On Mon, 2005-05-23 at 18:52 +0800, Qingqing Zhou wrote:
>> Now \d+ is able to show the tablespace details of indices.
> Should this be included in \d? Tablespace information for the table
> itself is, so I think we should probably do the same for indexes.
Seems reasonable. In the minor-carping department, I didn't much like
the formatting:
Indexes:
"mi" btree (i) - Tablespace: "testspace"
"mj" btree (j)
That looks a bit ugly to me ... not sure why, exactly, but maybe it's
that there's too much punctuation. The underlying CREATE INDEX command
would just look like
"mi" btree (i) tablespace "testspace"
Does that look better or worse to you?
regards, tom lane
From: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
---|---|
To: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Tablespaces |
Date: | 2005-06-03 03:17:21 |
Message-ID: | 429FCBC1.6020002@familyhealth.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
I'm interested if anyone is using tablespaces? Do we have any actual
reports of people actually using them, to advantage, in the field??
Maybe the next postgresql.org survey could be on tablespace usage?
Chris
From: | Neil Conway <neilc(at)samurai(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-03 05:41:45 |
Message-ID: | 1117777305.22984.51.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
On Thu, 2005-06-02 at 22:15 -0400, Tom Lane wrote:
> Does that look better or worse to you?
I agree the patch's format is a bit off. What about
"mi" btree (i), tablespace "testspace"
"PRIMARY KEY" is currently separated from the rest of the index
description via a comma -- although on the other hand the column list
isn't preceded by a comma. Perhaps this whole format should be
rethought?
-Neil
From: | Hans-Jürgen Schönig <postgres(at)cybertec(dot)at> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Tablespaces |
Date: | 2005-06-03 06:41:29 |
Message-ID: | 429FFB99.8070800@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Christopher Kings-Lynne wrote:
> I'm interested if anyone is using tablespaces? Do we have any actual
> reports of people actually using them, to advantage, in the field??
>
> Maybe the next postgresql.org survey could be on tablespace usage?
>
> Chris
>
I have seen that tablespaces are widely used and highly appreciated.
I have not seen people complaining about the current implementation.
best regards,
hans
--
Cybertec Geschwinde u Schoenig
Schoengrabern 134, A-2020 Hollabrunn, Austria
Tel: +43/664/393 39 74
www.cybertec.at, www.postgresql.at
From: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
---|---|
To: | Hans-Jürgen Schönig <postgres(at)cybertec(dot)at> |
Cc: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Tablespaces |
Date: | 2005-06-03 07:58:10 |
Message-ID: | 1117785490.3844.1177.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
On Fri, 2005-06-03 at 08:41 +0200, Hans-Jürgen Schönig wrote:
> Christopher Kings-Lynne wrote:
> > I'm interested if anyone is using tablespaces? Do we have any actual
> > reports of people actually using them, to advantage, in the field??
> >
> > Maybe the next postgresql.org survey could be on tablespace usage?
> >
>
> I have seen that tablespaces are widely used and highly appreciated.
> I have not seen people complaining about the current implementation.
>
My recent experience is that it is mostly the new Windows users who are
using 8.0. Yes, there are people using Tablespaces on those. The only
complaint is why can't you move pg_xlog easily also?
The migration to 8.0 for a many users appears very slow, with many
PostgreSQL users still planning to enter production on 7.3 and 7.4. This
has much to do with supported versions of integrated products, rather
than any lack of interest in 8.0.
Best Regards, Simon Riggs
From: | Simon Riggs <simon(at)2ndquadrant(dot)com> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Tablespaces |
Date: | 2005-06-03 08:00:20 |
Message-ID: | 1117785620.3844.1180.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
On Fri, 2005-06-03 at 11:17 +0800, Christopher Kings-Lynne wrote:
> Maybe the next postgresql.org survey could be on tablespace usage?
Could we plan a more comprehensive survey, with more than one question?
Judging by the number of people who fill out surveys, we would still get
thousands of replies if we asked them 10 questions instead of 1. That
would allow us to cross-correlate the answers to gain an even better
picture of what is happening and what is wanted.
Best Regards, Simon Riggs
From: | "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-04 02:10:16 |
Message-ID: | d7r2m2$202j$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
"Neil Conway" <neilc(at)samurai(dot)com> writes
> On Thu, 2005-06-02 at 22:15 -0400, Tom Lane wrote:
> > Does that look better or worse to you?
>
> I agree the patch's format is a bit off. What about
>
> "mi" btree (i), tablespace "testspace"
>
> "PRIMARY KEY" is currently separated from the rest of the index
> description via a comma -- although on the other hand the column list
> isn't preceded by a comma. Perhaps this whole format should be
> rethought?
>
yes, you are right, both forms you showed up are better than mine - the
reason I use that format is because add_tablespace_footer() prints a
"Tablespace: \"tablespace_name\"" in the PQExpBufferData. I could hack the
content in the buffer to make it looks better. Is this acceptable?
Regards,
Qingqing
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-04 02:59:43 |
Message-ID: | 200506040259.j542xhT19617@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Qingqing Zhou wrote:
>
> "Neil Conway" <neilc(at)samurai(dot)com> writes
> > On Thu, 2005-06-02 at 22:15 -0400, Tom Lane wrote:
> > > Does that look better or worse to you?
> >
> > I agree the patch's format is a bit off. What about
> >
> > "mi" btree (i), tablespace "testspace"
> >
> > "PRIMARY KEY" is currently separated from the rest of the index
> > description via a comma -- although on the other hand the column list
> > isn't preceded by a comma. Perhaps this whole format should be
> > rethought?
> >
>
> yes, you are right, both forms you showed up are better than mine - the
> reason I use that format is because add_tablespace_footer() prints a
> "Tablespace: \"tablespace_name\"" in the PQExpBufferData. I could hack the
> content in the buffer to make it looks better. Is this acceptable?
Yes, I am thinking you should replace the string "Tablespace:" with a
char pointer that is passed to the function and can be tailored to the
specific use.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> |
---|---|
To: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-04 06:54:26 |
Message-ID: | Pine.GSO.4.58.0506040251440.9525@qew.cs |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Now \d show tablespace of indices per discussion.
test=# \d e
Table "public.e"
Column | Type | Modifiers
--------+---------+-----------
i | integer | not null
j | integer | not null
k | integer |
Indexes:
"e_pkey" PRIMARY KEY, btree (i, j), tablespace "haha"
"ei" btree (i)
"ej" btree (j), tablespace "haha"
"ek" btree (k)
Tablespace: "haha"
Attachment | Content-Type | Size |
---|---|---|
describe.diff | text/plain | 5.5 KB |
From: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> |
---|---|
To: | mha(at)sollentuna(dot)net |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Simplify Win32 Signaling code |
Date: | 2005-06-04 13:25:41 |
Message-ID: | Pine.GSO.4.58.0506040918570.16123@dvp.cs |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Revised patch to avoid "lost signals before signaling mechanism is set up
in Win32". This was tested by plus a line:
Sleep(10*1000);
in the front of pgwin32_signal_initialize().
Regards,
Qingqing
Attachment | Content-Type | Size |
---|---|---|
kill.diff | text/plain | 4.0 KB |
postmaster.diff | text/plain | 4.4 KB |
signal.diff | text/plain | 15.3 KB |
win32.diff | text/plain | 2.0 KB |
From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu> |
Cc: | pgsql-patches(at)postgresql(dot)org |
Subject: | Re: psql: \d+ show tablespace of indices |
Date: | 2005-06-14 23:59:50 |
Message-ID: | 200506142359.j5ENxot12041@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-patches |
Patch applied. Thanks.
---------------------------------------------------------------------------
Qingqing Zhou wrote:
>
> Now \d show tablespace of indices per discussion.
>
> test=# \d e
> Table "public.e"
> Column | Type | Modifiers
> --------+---------+-----------
> i | integer | not null
> j | integer | not null
> k | integer |
> Indexes:
> "e_pkey" PRIMARY KEY, btree (i, j), tablespace "haha"
> "ei" btree (i)
> "ej" btree (j), tablespace "haha"
> "ek" btree (k)
> Tablespace: "haha"
>
>
Content-Description:
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073