sql问题 [英] sql question

查看:67
本文介绍了sql问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




如果我有一个像table1这样的表(c1 int,c2 date,c3 varchar)并且有29个b
bb的记录和我除表格分成小表,每个表格都有数据

一年如table1_2005只包含年份(c2)=

2005年的记录。


我如何在这些表上创建视图,以便从视图中看起来像单个表,并且中间件代码(java)不得有任何变化。



if i have one table like table1(c1 int,c2 date,c3 varchar) and has 29
million records and i divide table into small tables each having data
for one year like table1_2005 only contains records with year(c2) =
2005.

how can i create view on these tables so that from view it appears like
single table and there has to be no change in middleware code( java ).

推荐答案

我很抱歉回复我自己的消息但不知道如何编辑




i知道所有表的联合都可以工作但是不会在表上使用任何

索引。

11月28日下午1:16,db2admin < jag ... @ gmail.comwrote:
i am sorry for replying to my own message but do not know how to edit
it

i know that union of all table will work but that will not use any
index on tables.
On Nov 28, 1:16 pm, "db2admin" <jag...@gmail.comwrote:

hi,


如果我有一个像table1这样的表(c1 int,c2 date,c3 varchar)并有29

million记录,我将表分成小表,每个表都有数据

一年如table1_2005只包含年份记录( c2)=

2005.


如何在这些表上创建视图,以便从视图中看起来像

单表中间件代码(java)必须没有变化。


if i have one table like table1(c1 int,c2 date,c3 varchar) and has 29
million records and i divide table into small tables each having data
for one year like table1_2005 only contains records with year(c2) =
2005.

how can i create view on these tables so that from view it appears like
single table and there has to be no change in middleware code( java ).


" db2admin" < ja **** @ gmail.comwrote in message

news:11 ********************** @ h54g2000cwb.googlegr oups.com ...
"db2admin" <ja****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...

>我很抱歉回复我自己的消息但不知道如何编辑

it


i知道所有表的联合都可以工作,但不会在表上使用任何

索引。
>i am sorry for replying to my own message but do not know how to edit
it

i know that union of all table will work but that will not use any
index on tables.



我不知道为什么你说它不会使用索引。通常它会使用

索引。但是你可能需要发布你所有的DDL来看看你是做什么的。

I don''t know why you say it will not use an index. Normally it would use an
index. But you may need to post all of your DDL to look at what you are
doing.


对 - 一个UNION ALL视图应该是正是你需要的。你是否说b $ b你说你已经在基表上定义了索引但是他们没有使用
,或者你理解这些索引*不会*

被使用(即它是DB2的东西,而不是间接的东西)?


- 杰夫


Mark A写道:
Right-- a UNION ALL view should be exactly what you need. Are you
saying that you''ve defined indexes on the base tables but they''re not
being used, or that it''s your understanding that such indexes *won''t*
be used (i.e. it''s a DB2 thing, not a circumstantial thing)?

--Jeff

Mark A wrote:

" db2admin" < ja **** @ gmail.comwrote in message

news:11 ********************** @ h54g2000cwb.googlegr oups.com ...
"db2admin" <ja****@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...

i很抱歉回复我自己的消息但不知道如何编辑




i知道所有表的联合都可以工作,但不会在表上使用任何

索引。
i am sorry for replying to my own message but do not know how to edit
it

i know that union of all table will work but that will not use any
index on tables.



我不知道为什么你说它不会使用索引。通常它会使用

索引。但是你可能需要发布你所有的DDL来看看你做的是什么。


I don''t know why you say it will not use an index. Normally it would use an
index. But you may need to post all of your DDL to look at what you are
doing.


这篇关于sql问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆