=?UTF-8?B?6rmA64yA7Zi4?= <daiho1....@samsung.com> writes: > I suggest adding a limit option to the copy function that limits count of > input/output. > I think this will be useful for testing with sample data.
I'm quite skeptical of the value of this. On the output side, you can already do it with COPY (SELECT ... LIMIT n) TO wherever; Moreover, that approach allows you to include an ORDER BY, which is generally good practice in any query that includes LIMIT, in case you'd like deterministic results. On the input side, it's true that you'd have to resort to some outside features (perhaps applying "head" to the input file, or some such), or else copy the data into a temp table and post-process. But that's true for most ways that you might want to adjust or filter the input data; why should this one be different? We don't consider that COPY is a general-purpose ETL engine, and have resisted addition of features to it in the past because they'd slow down the primary use-case. That objection applies here too. Yeah, it's (probably) not a big slowdown ... but it's hard to justify any cost at all for a feature that is outside the design scope of COPY. regards, tom lane