If I have a display item to display 2 columns in 2 table: display item = col1||col2. Which way is better?
1. use PL/SQL in application to get those 2 columns.
select table1.col1||table2.col2
into display_item
from table1, table2
2. Create a view which combines those 2 column, and simply
select view.column
into display_item
from view.
I think if I have a huge table, No1 will take more time since it need to search 2 tables in front end. No2 is doing back end, it should take less time. Am I right? Thanks for any comment!
请教一个数据库的问题,综合考虑各种因素,运行速度等。
所有跟帖:
•
1 is better than 2
-安心草-
♀
(0 bytes)
()
10/10/2008 postreply
08:58:06
•
是以query的形式存在的,并没有占真正的空间。
-安心草-
♀
(104 bytes)
()
10/10/2008 postreply
10:48:20
•
回复:是以query的形式存在的,并没有占真正的空间。
-dropinto-
♀
(25 bytes)
()
10/10/2008 postreply
15:45:53
•
I prefer 2
-techy-
♀
(61 bytes)
()
10/10/2008 postreply
09:13:54
•
me 2
-澳洲老土-
♂
(0 bytes)
()
10/10/2008 postreply
14:38:27
•
if only for ONE query for this display, 1 is A LITTLE better.
-戏雨飞鹰-
♀
(178 bytes)
()
10/10/2008 postreply
09:33:35
•
(typo) But 1 does NOTneed to CREATE a view.
-戏雨飞鹰-
♀
(0 bytes)
()
10/10/2008 postreply
09:34:41
•
either way, you only select whatever neeeded to the display
-布衣之才-
♂
(48 bytes)
()
10/10/2008 postreply
09:34:50
•
u r right. but 2 still needs a lille time to create a VIEW first
-戏雨飞鹰-
♀
(0 bytes)
()
10/10/2008 postreply
09:38:00
•
use paging in font-end
-win963852741-
♂
(0 bytes)
()
10/10/2008 postreply
09:59:59
•
无需批爱儿爱似!Q爱儿, 无需建视图, a simple SQL will do.
-美国老土-
♂
(265 bytes)
()
10/10/2008 postreply
10:01:44
•
回复:无需批爱儿爱似!Q爱儿, 无需建视图, a simple SQL will do.
-win963852741-
♂
(100 bytes)
()
10/10/2008 postreply
10:05:17
•
Thanks for the info. and link. It's good to know. But our
-胖猴妹妹-
♀
(29 bytes)
()
10/10/2008 postreply
10:21:12
•
Thanks for all replies! For myself, I prefer 1 either.
-胖猴妹妹-
♀
(354 bytes)
()
10/10/2008 postreply
10:14:06
•
我俩个都选!哈哈哈!一个都不少!
-眼冒金星-
♂
(0 bytes)
()
10/10/2008 postreply
10:15:28
•
傻乐啥?捣浆糊来了?
-胖猴妹妹-
♀
(0 bytes)
()
10/10/2008 postreply
10:23:09
•
捣浆糊?给小妹来一笼王兴记小笼包
-胡说之-
♂
(10 bytes)
()
10/10/2008 postreply
14:27:35
•
There is no big performance difference between the two methods.
-rainmenz-
♂
(420 bytes)
()
10/10/2008 postreply
10:53:13
•
that't it. Indexes make a big difference , especially for the h
-戏雨飞鹰-
♀
(0 bytes)
()
10/10/2008 postreply
11:17:26
•
especially for the huge tables
-戏雨飞鹰-
♀
(0 bytes)
()
10/10/2008 postreply
11:17:54
•
看来这课没白上~~
-澳洲老土-
♂
(0 bytes)
()
10/10/2008 postreply
15:05:33
•
数据库弱智的真多
-dropinto-
♀
(0 bytes)
()
10/10/2008 postreply
15:48:14
•
说说看噢,我弱在哪里呀:)?真的很想知道LZ问题的答案。:)
-戏雨飞鹰-
♀
(0 bytes)
()
10/10/2008 postreply
21:56:10
•
高人啊
-以后再说-
♂
(196 bytes)
()
10/10/2008 postreply
23:19:45
•
hahaha...一大早看透王八语(SQL),高人!试看天下谁英豪?
-戏雨飞鹰-
♀
(63 bytes)
()
10/11/2008 postreply
07:52:49
•
就是吗,王八语只是餐前小菜,傻时变IQ测验了。
-以后再说-
♂
(0 bytes)
()
10/11/2008 postreply
09:16:42
•
What database system do you use?
-ffppyy-
♂
(180 bytes)
()
10/10/2008 postreply
19:13:26
•
hi,大侠。一定要告诉我们你的答案。本想把你喊出来的:)
-戏雨飞鹰-
♀
(0 bytes)
()
10/10/2008 postreply
21:59:24
•
I am far from a DX, Just a database person.
-ffppyy-
♂
(1386 bytes)
()
10/11/2008 postreply
11:31:11
•
俺顶你,有事没事就弄“景”(VIEW)的人,我总想再背后跩他一脚!
-以后再说-
♂
(0 bytes)
()
10/11/2008 postreply
14:14:23
•
who are you? you are new here? :)
-戏雨飞鹰-
♀
(0 bytes)
()
10/11/2008 postreply
14:30:48
•
我是who?, 以后再说!
-以后再说-
♂
(58 bytes)
()
10/11/2008 postreply
15:24:31
•
:) no need 以后再说.
-戏雨飞鹰-
♀
(0 bytes)
()
10/11/2008 postreply
15:27:23
•
Many thanks for the cogent answer :). I like it.
-戏雨飞鹰-
♀
(265 bytes)
()
10/11/2008 postreply
14:29:18
•
俺不懂了
-以后再说-
♂
(76 bytes)
()
10/10/2008 postreply
23:05:01
•
回复:俺不懂了
-ffppyy-
♂
(80 bytes)
()
10/11/2008 postreply
11:08:18