Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: "rename" and "create table x as select *" questions
Hi,
Instead of doing "create table x as select * from table y where 1=2;" do
CREATE TABLE x AS SELECT * FROM y WHERE ROWNUM < 2: TRUNCATE TABLE x;
Since only the first row of the table is retrieved this will run very quickly.
regards
Jerry Gitomer
Ying-fen Hu wrote in message <37501B63.81EB2672_at_generalmicro.com>...
>Dear Oracle Gurus,
>
>I have two questions:
>
>1. Will "rename" take a long time if the table is large? What are
>involved in the rename process?
>2. Will "create table x as select * from table y where 1=2;" take a
>long time if table y is very large (8 million rows)? I think it will.
>Although, this statement will create the structure only and no data are
>transferred to table y, the "where" clause will go through the usual SQL
>process. Therefore, if the table is large (millions of rows), the
>statement will take longer than if the table is smaller (hundreds of
>rows). Is it correct? I'd like to know what's happening behind the
>statement.
>
>Thank you in advance for your reply. For reply, please also e-mail to
>huy_at_ncr.disa.mil.
>
>Ying-fen Hu
>
>
>
Received on Tue Jun 01 1999 - 13:12:29 CDT
![]() |
![]() |