knizhnik / imcs

In-Memory Columnar Store extension for PostgreSQL
Apache License 2.0
203 stars 33 forks source link

how can I get the timeseries_id after cs_create #27

Closed amutu closed 10 years ago

amutu commented 10 years ago

in the doc: function cs_create(table_name text, timestamp_id text, timeseries_id text default null, autoupdate bool default false) returns void

there is a param timestamp_id,but after the cs created,where can I find which column I pass as timeseries_id.User need this column when use table_get().

amutu commented 10 years ago

the "argument data type" of the \df table_get can get the timeseries_id name and type,but user must parse the argument data type,it is not friendly.If there is some system table/view like information_schema which user can query the cs information,it will be better.

knizhnik commented 10 years ago

Sorry, there is no function in IMCS which returns name of timeseries identifier and timestamp fields. In all use cases which I have considered, it is obvious, for example if we have Quote table, then "Symbol" is the only column which can be identifier of timeseries and "Day" - the only column which can be used as timestamp.

Unfortunately I do not understand you second comment. What do you mean by "argument data type"? TABLE_get should be given value of timeseries identifier (i.e. "ABB" in case of Quote table and "Symbol" used as timeseries ID). Why "user must parse the argument data type"?

amutu commented 10 years ago

Sometimes it is obvious,but most time you shoud know the content of the table or understand the business of the data and then it become obvious.for complex system with many people involved,it is difficult for maintenance.

for the second comment ,see this: => \df _crashlogget

              List of functions
 Schema      |     Name     |     Result data type      |                                                         
                                       Argument data types                                                        
                                        |  Type  

-----------------+--------------+---------------------------+---------------------------------------------------------

--------------------------------------------+-------- u_client | crashlog_get | crashlog_timeseries | clientversion integer, from_ts timestamp without time zo ne DEFAULT NULL::timestamp without time zone, till_ts timestamp without time zone DEFAULT NULL::timestamp without time zone, limit_ts bigint DEFAULT NULL::bigint | normal u_client | crashlog_get | SETOF crashlog_timeseries | ids integer[], from_ts timestamp without time zone DEFAU LT NULL::timestamp without time zone, till_ts timestamp without time zone DEFAULT NULL::timestamp without time zone, l imit_ts bigint DEFAULT NULL::bigint | normal (2 rows)

if I want to get "clientversion integer",I must parse the "clientversion integer, from_ts timestamp without time zo ne DEFAULT NULL::timestamp without time zone, till_ts timestamp without time zone DEFAULT NULL::timestamp without time zone, limit_ts bigint DEFAULT NULL::bigint "

knizhnik commented 10 years ago

What actually do you want to know: just names of timeseries ID and timestamp columns? Will it be enough to add two generated functions: function TABLE_timestamp() returns varchar; function TABLE_timeseries_id() returns varchar;

amutu commented 10 years ago

Ye,that's enough,if user want more info,he can use the system table get more. thanks a lot!

knizhnik commented 10 years ago

I have added TABLE_timestamp() and TABLE_id() functions (revision 56)