get relationship between relid to foreign tablename.

80 views
Skip to first unread message

Honda Takayuki

unread,
Nov 13, 2015, 8:39:47 AM11/13/15
to cstore users
Hello, all.
I have a question.

I'm created foreign table of cstore_fdw.
Do you know how about get relationship between relid to foreign tablename?

sampledb=> SELECT datid, datname FROM pg_stat_database;
 datid |  datname
-------+-----------
     1 | template1
 12998 | template0
 13003 | postgres
 16410 | sampledb
(4 rows)

sampledb=> \d
                      List of relations
 Schema |            Name            |     Type      | Owner
--------+----------------------------+---------------+-------
 public | customer_reviews           | table         | sampledb
 public | customer_reviews_cstore    | foreign table | sampledb
(5 rows)

sampledb=> SELECT relid, relname FROM pg_stat_user_tables;
 relid |          relname
-------+----------------------------
 16498 | customer_reviews
※Not found foreign tablename.
(4 rows)

[postgres@localhost 16410]$ pwd
/data/pgsql/cstore_fdw/16410
[postgres@localhost 16410]$ ls -l
-rw------- 1 postgres postgres 761071901 11月 13 20:09 2015 17008
-rw------- 1 postgres postgres      2560 11月 13 20:09 2015 17008.footer
※This file about foreign table. but I want to get relid from Statistics Views.

best regards.

----
Takayuki Honda

Murat Tuncer

unread,
Nov 13, 2015, 1:22:05 PM11/13/15
to Honda Takayuki, cstore users
Hi Takayuki

foreign tables did not appear in pg_stat_user_tables.

You can query list of foreign tables and their relation id from pg_class using following query.

select relfilenode as relid, relname from pg_class where relkind ='f'; 




--
You received this message because you are subscribed to the Google Groups "cstore users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cstore-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Murat Tuncer
Software Engineer | Citus Data
mtu...@citusdata.com

Honda Takayuki

unread,
Nov 15, 2015, 9:29:29 PM11/15/15
to cstore users, hond...@gmail.com
Hi Murat

Thanks for your reply.


>foreign tables did not appear in pg_stat_user_tables.
>You can query list of foreign tables and their relation id from pg_class using following query.

I succeeded to get the relation from pg_class table.Thank you very mach.
cstore_fdw is very nice solution.I expect future update.


2015年11月14日土曜日 3時22分05秒 UTC+9 Murat Tuncer:
Reply all
Reply to author
Forward
0 new messages