code_junkie

How do you make Python / PostgreSQL faster?

Nov 11th, 2011
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. cursor.execute("UPDATE people SET chats_count = chats_count + 1 WHERE id = '%s'" % person_id)
  2.  
  3. cursor.execute( "INSERT INTO ... VALUES( %(x)s, %(y)s, %(z)s )", {'x':person_id, 'y':time_to_string(time), 'z':channel,} )
  4.  
  5. insert_statement="""
  6. INSERT INTO chats(person_id, message_type, created_at, channel)
  7. VALUES(:person_id,:message_type,:created_at,:channel)
  8. """
  9.  
  10. cursor.execute(insert_statement, person_id='person',message_type='msg',created_at=some_date, channel=3)
Add Comment
Please, Sign In to add comment