51 size_t *pointsTotal) {
52 clock_t start_t = clock();
54 const int tuple_limit = 1000000;
56 size_t total_tuples = 0;
61 for (i = 0; i < 2; ++i) {
79 (*pointsTotal) = total_tuples;
81 while (moredata ==
true) {
82 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
83 if (total_tuples == 0)
86 size_t ntuples = SPI_processed;
87 total_tuples += ntuples;
90 if ((*points) == NULL)
98 if ((*points) == NULL) {
99 elog(ERROR,
"Out of memory");
102 SPITupleTable *tuptable = SPI_tuptable;
103 TupleDesc tupdesc = SPI_tuptable->tupdesc;
106 for (t = 0; t < ntuples; t++) {
107 HeapTuple tuple = tuptable->vals[t];
109 &(*points)[total_tuples - ntuples + t]);
111 SPI_freetuptable(tuptable);
117 SPI_cursor_close(SPIportal);
120 if (total_tuples == 0) {
125 (*pointsTotal) = total_tuples;
126 time_msg(
" reading points:", start_t, clock());