Compare all records in table "A" with each record in table "B"

Asked

Viewed 275 times

0

I am a programmer and rarely use database, I came across an unusual situation of converting multiple files . DBF and save everything in the bank on their respective tables, however some files exceed more than 3 million records, as a programmer I tried to work using a code that picked up each record of a column of table A and compared with each one of a column of table B and said how many existed in table B, but the software hangs because of this absurd quantity, I Googled and found a remarkable guy named "JOIN", it would help me in my problem? There are 3 million in table A and another 3 million in table B, I need to automate this using the Oracle database, I need a query that automates this. Does anyone know? (That’s bad programmer who bad uses bank, I’m sorry)

1 answer

1


I get it. JOIN won’t be much different from the comparison query you made before not, it will probably lock the same way, but one solution is you limit the amount of records in the comparison to a limit of 10,000 records for example or even an ID x. After processing this amount you wait a couple of minutes and have another 10,000 records processed and so on understand? It is possible to do this via "sleep system" programming for these two minutes before starting to process again. Use a functional language to do this which will not lock no. If you use Elixir/Erlang you can process the three million at once.

In this example I created a thousand processes, but can create 3 million quietly:

https://gist.github.com/tiagodavi/65972bf781ac6130d5d4

$ elixir --erl "+P 3000000" -r chain.exs -e "Chain.run(3_000_000)"
  • I thought to do it this way, divide the data into parts, but just to confirm, the JOIN limited to a reasonable amount of records (not to crash) would work for what I am asking? As I said, I’m not there those things in Banco, JOIN I’ve known for a little while...

  • 1

    I believe so because you will be consulting the records gradually. Try to do this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.