I am using python for coding and psql for save my data. My problem is that when I write into database it takes about 2-3 minutes. Size of the data is about 1,200,000 (lines) and 3 columns.
Insertion function:
def store_data(cur,table_name,data):
cur.executemany(
"INSERT INTO"+" "+table_name+" "+"(name, date,id) VALUES (%s, %s, %s)",
[(data[i][0], data[i][1], data[i][2]) for i in xrange(0,len(data))]
)
cur.connection.commit()
How to speed-up function?