![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#31
| |||
| |||
|
|
From: Serge Rielau <srielau (AT) ca (DOT) ibm.com The OP's statement most likely stems from not understanding the differences between the two products. I don't think so.... Here is my take: The advantage of session-local temporary tables, that is tables who's definition is not persisted in the catalog has the advantage that ad-hoc tables can be created quickly without impacting the catalog and without a care whether some other session may have a table with the same name (but a different signature) The downside of this behavior is that it's somewhat challenging to use these kinds of tables across multiple objects because there is no guarantee that the procedure that is trying to use Temp1 actually gets Temp1 in the shape it expects it to be. |
#32
| |||
| |||
|
|
From: DA Morgan <damorgan (AT) psoug (DOT) org |
#33
| |||
| |||
|
|
On 18 Oct, 16:29, "Ian Michael Gumby" <im_gu... (AT) hotmail (DOT) com> wrote: BTW, when will Oracle get their act together and do temp tables right? Anyone who's had to suffer through their bastardized "global" temp tables can appreciate that a *real* database allows users to create temp tables on the fly as part of their adhoc queries. __________________________________________________ _______________ How do Oracle temp tables work? What is the problem with them? |
#34
| |||
| |||
|
|
How do Oracle temp tables work? What is the problem with them? They are global, in that they are defined by someone with DBA privileges, and the definitions are shared across all user sessions. Different user sessions can then use them, and their specific data extents are then local to that particular session, and can be temporary (or can be persisted if required). So average joe blow user session cannot create them. There has always been some discussion about which approach is more "correct". Obviously we at Oracle think this approach is better, for a number of really good reasons. We could also do temp tables the same way as informix and SQL Server, but have chosen to not implement them yet, also for a number of good reasons. It does make migration from these databases to Oracle a little problematic however |
#35
| |||
| |||
|
|
Serge Rielau wrote: DA Morgan wrote: david (AT) smooth1 (DOT) co.uk wrote: On 18 Oct, 16:29, "Ian Michael Gumby" <im_gu... (AT) hotmail (DOT) com> wrote: BTW, when will Oracle get their act together and do temp tables right? Anyone who's had to suffer through their bastardized "global" temp tables can appreciate that a *real* database allows users to create temp tables on the fly as part of their adhoc queries. __________________________________________________ _______________ How do Oracle temp tables work? What is the problem with them? In Oracle the tables are not temporary ... no need for them to be due to the difference in locking and transaction architecture. Rather it is the data within them that is transitory. There are two types of temp tables in Oracle ... the first for example: CREATE GLOBAL TEMPORARY TABLE gtt_zip2 ( zip_code VARCHAR2(5), by_user VARCHAR2(30), entry_date DATE) ON COMMIT DELETE ROWS; does precisely what the syntax indicates. The second has a different behavior: CREATE GLOBAL TEMPORARY TABLE gtt_zip3 ( zip_code VARCHAR2(5), by_user VARCHAR2(30), entry_date DATE) ON COMMIT PRESERVE ROWS; and empties itself at the end of a session. The advantages of Oracle's version of temp tables relates specifically to Oracle's use of undo segments and multiversion read consistency and would make no sense in Informix thus I can understand the attitude. In Oracle building Informix-type temp tables would be similarly bad design. Huh? DB2 for zOS has the same kind of temp tables (they are in the SQL Standard actually). Excuse me Serge but this isn't the DB2 usenet group. It's over there on your right. This is Informix and Oracle's temp table implementation is Oracle's. This has nothing to do with implementation. Semantics dictate |
#36
| |||
| |||
|
|
From: Serge Rielau <srielau (AT) ca (DOT) ibm.com The OP's statement most likely stems from not understanding the differences between the two products. I don't think so.... Here is my take: The advantage of session-local temporary tables, that is tables who's definition is not persisted in the catalog has the advantage that ad-hoc tables can be created quickly without impacting the catalog and without a care whether some other session may have a table with the same name (but a different signature) The downside of this behavior is that it's somewhat challenging to use these kinds of tables across multiple objects because there is no guarantee that the procedure that is trying to use Temp1 actually gets Temp1 in the shape it expects it to be. You're going to have to be a bit more specific in how you define "object". "Object" has different meanings to different people.... The disadvantage that you state is kind of meaningless in practice. If you think about it, the temp table is only persistant during a connection. So that the calling app that instantiated the connection should know how or what is defined by the temp table. And the name temp1 has to be unique per connection. (Meaning that connection A can create a temp1 table and connection B can create a temp table temp1 but they will be different objects...) The huge problem with Oracle's temp tables is that their definition isnt temp, its global. What is temporary is the data that you can maintain in the temp will last only as long as the session. So what happens if I want to load in 300,000 rows of temp data in to the temp table and there's no index on the table? (Hint: SEQUENTIAL SCAN OF THE TABLE). In Oracle, you can't create an index on a temp table if there are any rows in it, and you can't control who/what someone else does to the temp table. Interesting. I didn't know Oracle had this funny limitation. |
#37
| |||
| |||
|
|
How do Oracle temp tables work? What is the problem with them? They are global, in that they are defined by someone with DBA privileges, and the definitions are shared across all user sessions. Different user sessions can then use them, and their specific data extents are then local to that particular session, and can be temporary (or can be persisted if required). So average joe blow user session cannot create them. There has always been some discussion about which approach is more "correct". Obviously we at Oracle think this approach is better, for a number of really good reasons. We could also do temp tables the same way as informix and SQL Server, but have chosen to not implement them yet, also for a number of good reasons. It does make migration from these databases to Oracle a little problematic however Apologies - I now see that I glommed into the thread a little late. Something to do with a red-eye back from Argentina and leaping before I look. Serge's description of the differences is a good one. Tx, so is yours. Also agree on the migration issue. The impedance |
#38
| |||
| |||
|
|
DA Morgan wrote: Serge Rielau wrote: DA Morgan wrote: david (AT) smooth1 (DOT) co.uk wrote: On 18 Oct, 16:29, "Ian Michael Gumby" <im_gu... (AT) hotmail (DOT) com> wrote: BTW, when will Oracle get their act together and do temp tables right? Anyone who's had to suffer through their bastardized "global" temp tables can appreciate that a *real* database allows users to create temp tables on the fly as part of their adhoc queries. __________________________________________________ _______________ How do Oracle temp tables work? What is the problem with them? In Oracle the tables are not temporary ... no need for them to be due to the difference in locking and transaction architecture. Rather it is the data within them that is transitory. There are two types of temp tables in Oracle ... the first for example: CREATE GLOBAL TEMPORARY TABLE gtt_zip2 ( zip_code VARCHAR2(5), by_user VARCHAR2(30), entry_date DATE) ON COMMIT DELETE ROWS; does precisely what the syntax indicates. The second has a different behavior: CREATE GLOBAL TEMPORARY TABLE gtt_zip3 ( zip_code VARCHAR2(5), by_user VARCHAR2(30), entry_date DATE) ON COMMIT PRESERVE ROWS; and empties itself at the end of a session. The advantages of Oracle's version of temp tables relates specifically to Oracle's use of undo segments and multiversion read consistency and would make no sense in Informix thus I can understand the attitude. In Oracle building Informix-type temp tables would be similarly bad design. Huh? DB2 for zOS has the same kind of temp tables (they are in the SQL Standard actually). Excuse me Serge but this isn't the DB2 usenet group. It's over there on your right. This is Informix and Oracle's temp table implementation is Oracle's. This has nothing to do with implementation. Semantics dictate implementation. Nothing you described has anything to do with Orcale's vs. IDSs (and DB2, and SQL Server's) design. It is about DECLAREd TEMPS vs. CREATEd TEMPS. A DECLARE'd temp doesn't have any of that heavy code path overhead you describe. Whether you call it an index by table or a DGTT or a local temp... If you could take of those blinders and think of SQL as a language instead of as a binary shipped by Oracle vs. IBM you could follow me. Cheers Serge PS: There is more to once life choices than Fahrenheit. I'm in the right spot at the right time. |
#39
| |||
| |||
|
|
BTW: Obnoxio ... likely be in B'ham first week of December. |
#40
| |||
| |||
|
|
DA Morgan said: BTW: Obnoxio ... likely be in B'ham first week of December. You are a much, MUCH braver man than I. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |