What I did is on the website
http://stackoverflow.com/questions/25177642/how-to-select-efficiently-in-a-very-
large-table
I used RPostgreSQL package under R because I want to manipulate other files at
the same time. As you can see from the above website, the table is very large.
It will cost more than two hours to complete the selection using RPostgreSQL.
But today I use the same SQL code under PostgreSQL directly instead of using
RpostgreSQL. It only took several minutes. Why?
The code of R is:
sql='SELECT * into new_table FROM table_1 WHERE EXISTS (SELECT 1 FROM table_2
WHERE column=table_1.column_1) AND EXISTS (SELECT 1 FROM table_2 WHERE
column=table_1.column_2)'
rs=dbSendQuery(con,sql)
Original issue reported on code.google.com by guanghua...@gmail.com on 28 Aug 2014 at 9:49
Original issue reported on code.google.com by
guanghua...@gmail.com
on 28 Aug 2014 at 9:49