Changeset: acac15815533 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/acac15815533
Modified Files:
sql/backends/monet5/sql_bincopy.c
Branch: default
Log Message:
Use fstat before COPY BINARY ON SERVER
It's more efficient if we can know the number of records beforehand
diffs (18 lines):
diff --git a/sql/backends/monet5/sql_bincopy.c
b/sql/backends/monet5/sql_bincopy.c
--- a/sql/backends/monet5/sql_bincopy.c
+++ b/sql/backends/monet5/sql_bincopy.c
@@ -40,6 +40,14 @@ load_trivial(BAT *bat, stream *s, const
const size_t asz = (size_t) ATOMsize(tt);
const size_t chunk_size = 1<<20;
+ if (rows_estimate == 0) {
+ int64_t file_size = getFileSize(s);
+ rows_estimate = (BUN)file_size / asz;
+ // getFileSize returns 0 if the underlying file could not be
stat'ed, so
+ // rows_estimate will just still be 0 if anything went wrong
(io error,
+ // s not a file stream)
+ }
+
bool eof = false;
while (!eof) {
assert(chunk_size % asz == 0);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]