pyPgSQL vs psycopg2 第ä¸å pyPgSQLã¨psycopg2ã®å¦çé度ã®æ¯è¼ããã¦ã¿ãã ä»åã¯ãããããã®ã¢ã¸ã¥ã¼ã«ã使ã£ã¦SELECTåãçºè¡ãã ãã¼ã¿åå¾ã§ããã¾ã§ã®æéã測å®ãã¦ã¿ãã ãã¹ãç¨ã«ãã¼ã¿ãã¼ã¹ãä½æï¼ä»¥ä¸ï¼ããã -- postgres : 8.1.4 database : testDb table : testTable -- testTableã®ã¹ãã¼ãã¯ä»¥ä¸ã®ã¨ããã -- char(1) à 6, integer à 4 -- ãã®testTableã«ã60ä¸è¡ã®ãã¼ã¿ãç»é²ããã ï¼testTableã®ãã¼ã¿ãpg_dumpã§ãã³ããããã 20MBã®ãã¡ã¤ã«ãä½æããããï¼ ãã®å¾ã以ä¸ã®ã³ãã³ãã§ãsqlãå®è¡ãããã®å¦çæéãè¨æ¸¬ããã > python >>> # psycopg2 >>> import time >>> pr
pythonããpostgresã¸COPYã³ãã³ãã使ãæ¹æ³ 大éã®ãã¼ã¿ããã¼ã¿ãã¼ã¹ã«ç»é²ããå ´åã Insertæãç¹°ãè¿ãããã \COPYã³ãã³ããå©ç¨ãã¦ããã¡ã¤ã«ãããã¼ã¿ãç»é²ããæ¹ãéãã INSERTæï¼ postgres> INSERT INTO table (id, name, comment) VALUES (1, 'test', 'test_line'); postgres> INSERT INTO table (id, name, comment) VALUES (2, 'test2', 'test2_line'); \COPYæï¼ > cat test_file 1 test1 test_line 2 test2 test2_line postgres> \COPY table (id, name, comment) FROM test_file ä¸è¿°ã®\C
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}