![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
From a huge table, I want to read random records via JDBC to make some statistic things. How do I best and fastest afford this? Just like this: "select * from ... where rowid=?" or are there better ways? JMS |
#2
| |||
| |||
|
|
Use the SAMPLE clausehttp://www.psoug.org/library.html scroll down to "SAMPLE CLAUSE." |
#3
| |||
| |||
|
|
Use the SAMPLE clausehttp://www.psoug.org/library.html scroll down to "SAMPLE CLAUSE." Thank you very much for your good idea! But I did not tell the whole truth: I want to read random records from two tables and compare them. So I read record 883 from table1 and record 883 from table2 and compare the fields. Then I continue with another record. Martin |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Would it make sense to create 10 rowids in java and then do a query like that: select * from table where rowid in ("2378","98989","127489","100323"....) Thanks, Martin |
#6
| |||
| |||
|
|
It might unless one were to consider that ROWID is a reserved word in Oracle with a very specific meaning. |
#7
| |||
| |||
|
|
Use the SAMPLE clausehttp://www.psoug.org/library.html scroll down to "SAMPLE CLAUSE." Thank you very much for your good idea! But I did not tell the whole truth: I want to read random records from two tables and compare them. So I read record 883 from table1 and record 883 from table2 and compare the fields. Then I continue with another record. Martin |
#8
| |||
| |||
|
|
There are no records in a database, only rows. |
|
So exactly what is the key that makes the rows comparable? Use that. IOW, select a sample from table 1 and fectch the rows with the same keys from table 2, and then compare. |
#9
| |||
| |||
|
|
There are no records in a database, only rows. I just checked the official oracle docu. It's not called "rows", it's called "zeilen"! |
|
So exactly what is the key that makes the rows comparable? Use that. IOW, select a sample from table 1 and fectch the rows with the same keys from table 2, and then compare. I want to compare the tables physically, by rows, and not by key. I don't know the keys, the program deals with different tables. JMS |
#10
| |||
| |||
|
|
I have always tried to follow the tenet "there are no stupid questions" when I read newsgroups, but this thread is pushing my limits. Just how would you select the row from the second table? Think about what you seem to be attempting to do. Consider this outside the context of Oracle. Let say you were comparing two files (then record is the correct term). You somehow randomly select records out of the first file, then what would be the corresponding record in the second file? I compare the row 1 in table 1 with row 1 in table 2, then row 100 in table 1 with row 100 in table 2. Nothing spectacular. My program works, but is very slow. JMS |
![]() |
| Thread Tools | |
| Display Modes | |
| |