I am doing many SQL insert statements to insert records into an oracle
database. I need the order of the records, after inserting all records, to
be the same as the order I inserted them in. Right now my program fails to
keep the records in order if the number of records is large. I inserted
100,000 records and the first record after all inserts were done was
record#540. I have been told that the /*+ APPEND */ hint and /*+ PARALLEL */
hint can accomplish this. Is this correct? I want to avoid using ORDER BY at
all costs as its slow and I can't affort the slowdown. Has anyone else had
this problem? and can help.
Example: If I insert records with employee numbers 1 throughy 100,000 into
the oracle database in ascending order, then the first record viewed after
inserting all records should be record with employee number1. The last
record should be record with employee number 100, 000.
thanks.
Ryan 2 4988
Ryan, I am doing many SQL insert statements to insert records into an oracle database. I need the order of the records, after inserting all records, to be the same as the order I inserted them in. Right now my program fails to keep the records in order if the number of records is large. I inserted 100,000 records and the first record after all inserts were done was record#540. I have been told that the /*+ APPEND */ hint and /*+ PARALLEL */ hint can accomplish this. Is this correct? I want to avoid using ORDER BY at all costs as its slow and I can't affort the slowdown. Has anyone else had this problem? and can help.
Stop messing about with hints and use an Order By. One of the
fundamental rules of relational databases is that the order rows are
physiclly stored is not something you control directly. If your data is
inherently ordered (e.g. a top 10 list) and doesn't have something you
can sort by (e.g. family name. employee number) then add a number column
and use an Oracle sequence to assign an order to records.
Where did you get the idea that Order By would be slow?
You should make a trip to your local bookstore and buy (or failing that
read!) a book on Relational Database theory.
David Rolfe
Orinda Software
Dublin, Ireland
Ryan Wagner wrote: I am doing many SQL insert statements to insert records into an oracle database. I need the order of the records, after inserting all records, to be the same as the order I inserted them in. Right now my program fails to keep the records in order if the number of records is large. I inserted 100,000 records and the first record after all inserts were done was record#540. I have been told that the /*+ APPEND */ hint and /*+ PARALLEL */ hint can accomplish this. Is this correct? I want to avoid using ORDER BY at all costs as its slow and I can't affort the slowdown. Has anyone else had this problem? and can help.
Example: If I insert records with employee numbers 1 throughy 100,000 into the oracle database in ascending order, then the first record viewed after inserting all records should be record with employee number1. The last record should be record with employee number 100, 000.
thanks.
Ryan
Making Oracle store data in an order you want is impossible. The closest
solution would be to create an index or an index organized table. Oracle
will then use the order in index to optimize the ORDER BY.
Witold Andrzejewski This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bob Bedford |
last post by:
I've a site where companies add their article.
I'de like to provide a "lasts articles" table. By this, I'll show last
articles inserted. But I won't always the same articles at any refresh.
Question 1: how to get a "random" selection from the database, giving more
priority to the last inserted (the ones with higher articleID)
Question 2: I'd like to provide one article by client. I won't show 3
articles from the same client only because...
|
by: Patrizio |
last post by:
Hi All,
I've the following table with a PK defined on an IDENTITY column
(INSERT_SEQ):
CREATE TABLE MYDATA (
MID NUMERIC(19,0) NOT NULL,
MYVALUE FLOAT NOT NULL,
TIMEKEY INTEGER NOT NULL,
TIMEKEY_DTTM DATETIME NULL,
|
by: george |
last post by:
This is like the bug from hell. It is kind of hard to explain, so
please bear with me.
Background Info: SQL Server 7.0, on an NT box, Active Server pages
with Javascript, using ADO objects.
I'm inserting simple records into a table. But one insert command is
placing 2 or 3 records into the table. The 'extra' records, have the
same data as the previous insert incident, (except for the timestamp).
|
by: siatki |
last post by:
Hello,
Firstly, sorry for my english.
I have problem with creating SQL statement. I am beginner and I think that
it is very easy to do. Look -
I have to get only the last 20 records from table ABC (f.eg.) and according
to that how to create the SQL statement? F.eg. SELECT name, forename, date
FROM abc WHERE....
You know - how to finish the statement to get only 20 records lastly
inserted into the table?
Thanks and I am waiting for...
|
by: Guru |
last post by:
Hi
I have a table which contains number of rows. I want to fetch the
last 5 records from the table. I know for the first 'n' records we can
use FETCH FIRST n ROWS ONLY command. But i want to fetch last 5
records. Can any one help in this...
| |
by: bevanward |
last post by:
Hi All
I am finding unexpected results when inserted into a newly created
table that has a field of datatype int identity (1,1).
Basically the order I sort on when inserting into the table is not
reflected in the order of the values from the identity field.
Have I been wrong in assuming that it should reflect the order from the
sort?
|
by: Paul |
last post by:
I have a process that I want to speed up. It first was written in
Microsoft Access then converted to VB.NET. I would like to hear some
suggestions on how to speed it up. The process is to match names using
a Soundex function. It reads through a table of about 20,000 records
and matches it with a table of about 9,000 records. That is all done
in code. The tables are stored in SQL Server 2005.
Soundex is a numerical formula to...
|
by: deepthithallada |
last post by:
Hi,
While inserting records in the table, is there any way we can change the order in which we insert the records.
Eg: Say i have 3 columns in a table, while inserting the records can i make the system such that rather than inserting the records in a first come first serve basis they are inserted based on ascending or descending order of any column value.
|
by: ebindia0041 |
last post by:
This is like the bug from hell. It is kind of hard to explain, so
please bear with me.
Background Info: SQL Server 7.0, Asp.net 1.1 with c#
I'm inserting simple records into a table. But one insert command is
placing 2 or 3 records into the table. The 'extra' records, have the
same data as the previous insert incident, (except for the timestamp).
Here is an example. Follow the values of the 'Search String' field:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |