Hello,
Let me ask the question first, then I'll describe the situation below so
that you may provide further ideas.
Would it be faster on large tables to create a view then insert to the view?
If so, how are Serial types handled as I use the serial from one table as
the foreign key to another. Also, I've thought about two temp tables as the
inserts are much faster but then I can't figure out how to merge those
tables back into the larger tables maintaining the keys. Any ideas? Thanks
in advanced.
Let me start by describing my situation. I have two tables...one has a
foreign key to the other
ex.
grades
-----------
grade_id (serial)
student_id
grade
datecomplete
Students
-----------
student_id (serial)
Name
phone
where grades.student_id is foreign key to sudents.student_id
There are about 600,000 grades record and about 400,000 student records
I do the insert in a stored proc
I will write psuedo code for speed sake.
proc_Add_Grade (IN inName varchar(100), IN grade varchar(1), out
intreturnval int)
var existing_student_id as int
as
call proc_Student_Id(:inName,:existing_student_id);
// this returns the stundents name or inserts it if not there
insert into grades VALUES(:existing_student_id,grade,timestamp);
The actual tables are a little more complex but the idea is the same. It
takes about 5 minutes to process 10,000 records. I am looking to optimize
this. if the tables are empty, it takes less than a minute. I have created
indexes. The slowness is obviously a function of size. I would like to
avoid this.
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]