对于特殊字段,比如外键,主键,在不知道外键主键名的情况下,需要如下操作select constrname from sysconstraints where constrtype='R' and tabid= ( select tabid from systables where tabname = 'tst_1' ) ; ----'R'查找外键,'P'查找主键------针对informix数据库-----------------------------------------------
遇到一个问题,有几个结构一个的查询,表的索引建的也一样,但是有的查询很快,有的却很慢,需要半分钟以上才能执行完. 查看执行计划,并没有什么区别.找了很久原因才发现是主查询和子查询所涉及的表的字符编码不一致.改为一致后,问题解决. sql如下: delete from t_diag_detection WHERE reportName NOT IN (SELECT reportName FROM t_diag_reportinfo) 原因是 t_diag_detection表的字符编码是utf8m
环境:Oracle 11.2.0.3 需求:生产一张表由于前期设计不当,没有主键.现需要添加主键,数据量很大,想并行建立. 1.直接添加,提示ora-3001:未实施的功能;只能单线程建立主键 SQL> alter table t add constraint pk_t primary key (object_id) using index online parallel 2; alter table t add constraint pk_t primary key (object_id)
接下来看看下面index部分的源码实现: data := struct { Name string Des string }{ Name: "hello world this is bone", Des: "this is a good time", } // index some data index.Index("id", data) 其中, index.Index("id", data) 实现代码: // Index a