COPY issue(gsoc project)
От | longlong |
---|---|
Тема | COPY issue(gsoc project) |
Дата | |
Msg-id | d9f0a46b0803110556w29795e10p40c9e5439eb4f59d@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: COPY issue(gsoc project)
(Neil Conway <neilc@samurai.com>)
|
Список | pgsql-hackers |
i want to paticipate in gsoc 2008. <br /><br />here is my plan:<br /><span style="color: rgb(255, 0, 0);">the red part</span>is came from <span class="ppt" id="_user_gsmith@gregsmith.com">Greg Smith(thanks for </span><span class="ppt"id="_user_gsmith@gregsmith.com">Greg Smith's advice</span><span class="ppt" id="_user_gsmith@gregsmith.com">).</span><br/><br />1.release8.2 make COPY TO can copy the output of an arbitrary SELECT<br/>statement. so i think maybe COPY FROM can get data from output and 'insert<br /> into' some column that designated.the format of the command will be<br />discussed.<br /><br /><span style="color: rgb(255, 0, 0);">This would bea nice feature. Right now there are often applications</span><br style="color: rgb(255, 0, 0);" /><span style="color:rgb(255, 0, 0);">where there is a data loading or staging table that ends up being merged</span><br style="color:rgb(255, 0, 0);" /><span style="color: rgb(255, 0, 0);">with a larger table after some cleanup. Moving thatdata from the</span><br style="color: rgb(255, 0, 0);" /><span style="color: rgb(255, 0, 0);">preperation area into thefinal table right now is most easily done with</span><br style="color: rgb(255, 0, 0);" /><span style="color: rgb(255,0, 0);">INSERT INTO X (SELECT A,B FROM C) type actions. This is slow because</span><br style="color: rgb(255, 0,0);" /><span style="color: rgb(255, 0, 0);">INSERT takes much longer than COPY. Adding support for COPY X FROM</span><brstyle="color: rgb(255, 0, 0);" /><span style="color: rgb(255, 0, 0);">(SELECT A,B FROM C) would make this problemgo away.</span><br style="color: rgb(255, 0, 0);" /><br style="color: rgb(255, 0, 0);" /><span style="color: rgb(255,0, 0);">It is possible to do this right now with some clever use of STDIN/OUT like</span><br style="color: rgb(255,0, 0);" /><span style="color: rgb(255, 0, 0);">the below, but having a pure SQL solution would be more widely applicable.</span><brstyle="color: rgb(255, 0, 0);" /><span style="color: rgb(255, 0, 0);">The overhead of having to passeverything through the client (as STDIN/OUT</span><br style="color: rgb(255, 0, 0);" /><span style="color: rgb(255, 0,0);">do) is certainly not zero.</span><br style="color: rgb(255, 102, 102);" /><br />2.this come from TODO list: COPY alwaysbehaviors like a unit of work thar <br />consists of some insert commands, if any error, it rollback. but sometimes<br/>we only care the data should be inserted. in that situation, i used to use<br /> "try....catch...." insertrow by row to skip the error, because it will take<br />much time to examine every row. so:<br /> Allow COPY toreport error lines and continue. <br />this is a good idea.<br /><br /><span style="color: rgb(255, 0, 0);">This is along standing request and many people would be happy to see it</span><br style="color: rgb(255, 0, 0);" /><span style="color:rgb(255, 0, 0);">implemented. You do want to make sure the implementation easily allows</span><br style="color:rgb(255, 0, 0);" /><span style="color: rgb(255, 0, 0);">pushing all the lines that didn't commit into what'scommonly called a</span><br style="color: rgb(255, 0, 0);" /><span style="color: rgb(255, 0, 0);">"reject file".<br/><br /><span style="color: rgb(0, 0, 0);">----------------------------------------------------------------------------<br/><br />is these feasible? <br />whichone should i choose to proposal or both?</span></span><span style="color: rgb(255, 0, 0);"><span style="color: rgb(0,0, 0);"></span><span style="color: rgb(0, 0, 0);"></span><br /></span>
В списке pgsql-hackers по дате отправления: