A query took >20 minutes to finish.
The table ('trips') in my test has 0.5B rows. Somehow MapD takes >20 minutes to finish the following query:
$ time echo "select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);" | /mnt/mapd-core/bin/mapdql ma
pd -u $MAPD_USERNAME -p $MAPD_PASSWORD
User mapd connected to database mapd
EXPR$0
1
User mapd disconnected from database mapd
real 21m20.315s
user 0m0.008s
sys 0m0.000s
With the same number of rows on the same machine, another database finished it in 4 minutes, so it shouldn't take >4 minutes to read the two related columns (pickup_datetime and medallion) of the 0.5B rows from disk into cpu memory.
Please share any idea about how i can improve the query performance. Thanks.
Please include the full log from each of the runs so we can help diagnose your issue.
@dwayneberry Here you go.
cat /mnt/trip/mapd/data/mapd_log/mapd_server.INFO
Log file created at: 2017/10/04 23:47:40
Running on machine: osboxes
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
I1004 23:47:40.843778 12241 MapDServer.cpp:504] MapD started with data directory at '/mnt/trip/mapd/data'
I1004 23:47:40.893003 12241 MapDServer.cpp:511] Watchdog is set to 1
I1004 23:47:40.893019 12241 MapDServer.cpp:533] cuda block size 0
I1004 23:47:40.893026 12241 MapDServer.cpp:534] cuda grid size 0
I1004 23:47:40.893029 12241 MapDServer.cpp:535] calcite JVM max memory 1024
I1004 23:47:40.893033 12241 MapDServer.cpp:536] MapD Server Port 9091
I1004 23:47:40.893038 12241 MapDServer.cpp:537] MapD Calcite Port 9093
I1004 23:47:40.893069 12241 MapDHandler.cpp:133] MapD Server 3.3.1dev-20171002-b876cd7
E1004 23:47:40.893075 12241 MapDHandler.cpp:140] This build isn't CUDA enabled, will run on CPU
I1004 23:47:41.051996 12241 DataMgr.cpp:120] cpuSlabSize is 4096M
I1004 23:47:41.052139 12241 FileMgr.cpp:116] Read table metadata, Epoch is 0 for table data at '/mnt/trip/mapd/data/mapd_data/table_0_0/'
I1004 23:47:41.052494 12241 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1004 23:47:41.052510 12241 Calcite.cpp:95] Running calcite server as a daemon
E1004 23:47:41.370436 12241 Calcite.cpp:101] Appears to be orphaned Calcite serve already running, shutting it down
E1004 23:47:41.370517 12241 Calcite.cpp:102] Please check that you are not trying to run two servers on same port
E1004 23:47:41.370537 12241 Calcite.cpp:103] Attempting to shutdown orphaned Calcite server
E1004 23:47:41.381640 12241 Calcite.cpp:109] orphaned Calcite server shutdown
I1004 23:47:41.706120 12241 Calcite.cpp:124] Calcite server start took 300 ms
I1004 23:47:41.706172 12241 Calcite.cpp:125] ping took 22 ms
I1004 23:47:41.711787 12241 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1004 23:47:41.712116 12241 MapDHandler.cpp:172] No GPUs detected, falling back to CPU mode
I1004 23:47:41.712280 12241 MapDHandler.cpp:181] Started in CPU mode
I1004 23:48:01.388016 12265 MapDHandler.cpp:311] User mapd connected to database mapd
I1004 23:48:01.432214 12265 MapDHandler.cpp:2090] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1004 23:48:01.434177 12265 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1004 23:48:17.079310 12264 FileMgr.cpp:116] Read table metadata, Epoch is 134799 for table data at '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1005 00:08:28.929255 12265 Calcite.cpp:260] Time in Thrift 45 (ms), Time in Java Calcite server 1227449 (ms)
I1005 00:08:29.026374 12265 RelAlgOptimizer.cpp:301] ID=5 (RelProject<140318729320304> (RexInput 1 140318729320032)) deleted!
I1005 00:08:29.026932 12265 RelAlgOptimizer.cpp:706] (RelProject<140318729253456> (RexInput 0 140318729254192) (RexInput 5 140318729254192)) eliminated 1 columns.
I1005 00:08:29.027029 12265 RelAlgOptimizer.cpp:706] (RelAggregate<140318729320032>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1005 00:08:29.503226 12399 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1005 00:09:20.632467 12265 MapDHandler.cpp:2188] Total: 1279200 (ms), Execution: 1279168 (ms)
I1005 00:09:20.666656 12265 MapDHandler.cpp:321] User mapd disconnected from database mapd
I1005 00:27:55.632702 12270 MapDHandler.cpp:311] User mapd connected to database mapd
I1005 00:27:55.633719 12270 MapDHandler.cpp:2090] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1005 00:27:55.634567 12270 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1005 00:27:55.677237 12270 Calcite.cpp:260] Time in Thrift 2 (ms), Time in Java Calcite server 40 (ms)
I1005 00:27:55.677875 12270 RelAlgOptimizer.cpp:301] ID=5 (RelProject<140313294003328> (RexInput 1 140313294003056)) deleted!
I1005 00:27:55.678076 12270 RelAlgOptimizer.cpp:706] (RelProject<140313293998464> (RexInput 0 140313294000288) (RexInput 5 140313294000288)) eliminated 1 columns.
I1005 00:27:55.678119 12270 RelAlgOptimizer.cpp:706] (RelAggregate<140313294003056>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1005 00:27:55.835714 12270 MapDHandler.cpp:2188] Total: 201 (ms), Execution: 200 (ms)
I1005 00:27:55.836180 12270 MapDHandler.cpp:321] User mapd disconnected from database mapd
It is taking over 1227 seconds to read the metadata of your single table
I1005 00:08:28.929255 12265 Calcite.cpp:260] Time in Thrift 45 (ms), Time in Java Calcite server 1227449 (ms)
Please bring your branch up to date and rerun the queries and we will get more info as there have been changes in that area to generate more detailed information, but it appears you have done a very large number of potentially small inserts into the table which will cause a lot of checkpoints to be written which need to be read and processed when the DB first tries to access that table.
I just also found that any query immediately after mapd core starts took that long time too :)
Yeah. The table was not loaded by LOAD (COPY) but by (many many) batches of INSERT which tried to simulate data injection in normal IoT applications. I was not aware that caused a lot of checkpoints to be written.
[added] Perhaps this checkpoint stuff relates with the 'extra' issue pointed out at tail of issue #82
@dwayneberry
New code is 5 mins faster.
$ time echo "select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);" | /mnt/mapd-core/bin/mapdql mapd -u $MAPD_USE
RNAME -p $MAPD_PASSWORD
User mapd connected to database mapd
EXPR$0
1
User mapd disconnected from database mapd
real 14m57.288s
user 0m0.004s
sys 0m0.004s
Here is the INFO log:
$ tail -f /mnt/trip/mapd/data/mapd_log/mapd_server.INFO
I1005 03:18:28.604209 5632 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1005 03:18:28.604238 5632 Calcite.cpp:95] Running calcite server as a daemon
I1005 03:18:29.269129 5632 Calcite.cpp:124] Calcite server start took 600 ms
I1005 03:18:29.269230 5632 Calcite.cpp:125] ping took 30 ms
I1005 03:18:29.275961 5632 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1005 03:18:29.276314 5632 MapDHandler.cpp:174] No GPUs detected, falling back to CPU mode
I1005 03:18:29.276355 5632 MapDHandler.cpp:183] Started in CPU mode
I1005 03:18:32.843989 5659 MapDHandler.cpp:314] User mapd connected to database mapd
I1005 03:18:32.844525 5659 MapDHandler.cpp:2181] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1005 03:18:32.845162 5659 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1005 03:22:41.262905 5654 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 247482ms Epoch: 134799 files read: 544 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1005 03:32:37.907827 5654 Catalog.cpp:1510] Instantiating Fragmenter for table trips took 844152ms
I1005 03:32:38.021816 5654 Catalog.cpp:1556] Time to load Dictionary 1 was 112ms
I1005 03:32:38.096951 5654 Catalog.cpp:1556] Time to load Dictionary 2 was 75ms
I1005 03:32:38.170095 5654 Catalog.cpp:1556] Time to load Dictionary 3 was 73ms
I1005 03:32:38.226166 5654 Catalog.cpp:1556] Time to load Dictionary 4 was 56ms
I1005 03:32:38.652088 5659 Calcite.cpp:260] Time in Thrift 7 (ms), Time in Java Calcite server 845799 (ms)
I1005 03:32:38.684180 5659 RelAlgOptimizer.cpp:301] ID=5 (RelProject<139645895849840> (RexInput 1 139645895849568)) deleted!
I1005 03:32:38.684833 5659 RelAlgOptimizer.cpp:707] (RelProject<139645895782992> (RexInput 0 139645895783728) (RexInput 5 139645895783728)) eliminated 1 columns.
I1005 03:32:38.684877 5659 RelAlgOptimizer.cpp:707] (RelAggregate<139645895849568>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1005 03:32:39.012008 8480 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1005 03:33:30.045377 5659 MapDHandler.cpp:2279] Total: 897200 (ms), Execution: 897160 (ms)
I1005 03:33:30.109776 5659 MapDHandler.cpp:324] User mapd disconnected from database mapd
Bought 8GB RAM today. That significantly improves performance of the 1st query on mapd cold starts.
$ time echo "select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);" | /mnt/mapd-core/bin/mapdql mapd
-u $MAPD_USERNAME -p $MAPD_PASSWORD
User mapd connected to database mapd
EXPR$0
1
User mapd disconnected from database mapd
real 5m2.900s
user 0m0.008s
sys 0m0.016s
Interestingly, with extra 8GB RAM, the other database (CH) uses 150 secs to complete the same query on cold start, but it still uses 150s on 2nd+ queries after warm up. In contrast, MapD uses <1s on 2nd+ queries 👍 I guess, MapD's TEXT ENCODING DICT data type plays a critical role here. CH has no similar data type so it has to load 0.5B string column values every time which can't fit in my 14GB total memory. Such a guess can be foiled by a different query that needs a smaller-size column than medallion column. For example, to complete the following query on cold start:
select count(*) from (select max(pickup_datetime) from trips prewhere dropoff_datetime = '2014-04-23 03:17:00' group by dropoff_datetime)
MapD uses 5m55s; CH uses 22s. After warm up, both databases took almost the same time (<1s) to finish 2nd+ instances of the query.
This issue seems resolvable or alleviated simply by adding more memory, so i think this issue can be closed.
Hi @dwayneberry. Found a way to speed up "cold start" of BIG tables.
From profiling, bottleneck is the for-loop of FileInfo::openExistingFile. Key factor seems more on the number of pages of a table than on the number of checkpoints.
The idea behind is simple -- gather 'headers' of all pages in a file and relocate them to front of the file to form a 'super page'. This way, it take only few milliseconds to read the super page of a file which contains all headers of the file.
In contrast, previously for each file it took 3-15 seconds to load the headers thru many fseek/fread operations.
From INFO log below, with this file format, loading table schema of a 0.5B-row table takes <2s and execution of the first query on cold start now took 53s to finish. (versus previous 247s on loading schema and 305s on query)
E1009 09:03:33.604703 30227 MapDHandler.cpp:174] No GPUs detected, falling back to CPU mode
I1009 09:03:33.604737 30227 MapDHandler.cpp:183] Started in CPU mode
I1009 09:04:06.482470 30304 MapDHandler.cpp:314] User mapd connected to database mapd
I1009 09:04:06.520790 30304 MapDHandler.cpp:2181] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1009 09:04:06.525681 30304 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1009 09:04:09.405311 30302 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 1984ms Epoch: 3920 files read: 94 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1009 09:04:19.192484 30302 Catalog.cpp:1510] Instantiating Fragmenter for table trips took 11782ms
I1009 09:04:19.332147 30302 Catalog.cpp:1556] Time to load Dictionary 1 was 139ms
I1009 09:04:19.409219 30302 Catalog.cpp:1556] Time to load Dictionary 2 was 76ms
I1009 09:04:19.495249 30302 Catalog.cpp:1556] Time to load Dictionary 3 was 85ms
I1009 09:04:19.546556 30302 Catalog.cpp:1556] Time to load Dictionary 4 was 51ms
I1009 09:04:19.837051 30304 Calcite.cpp:260] Time in Thrift 20 (ms), Time in Java Calcite server 13291 (ms)
I1009 09:04:19.852845 30304 RelAlgOptimizer.cpp:301] ID=5 (RelProject<139695489300336> (RexInput 1 139695489300064)) deleted!
I1009 09:04:19.853183 30304 RelAlgOptimizer.cpp:707] (RelProject<139695489233488> (RexInput 0 139695489234224) (RexInput 5 139695489234224)) eliminated 1 columns.
I1009 09:04:19.853225 30304 RelAlgOptimizer.cpp:707] (RelAggregate<139695489300064>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1009 09:04:20.286516 32514 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1009 09:04:59.818516 30304 MapDHandler.cpp:2279] Total: 53297 (ms), Execution: 53297 (ms)
This time i used LOAD to load the 0.5B rows. The number of checkpoints are only 1/5 (i don't know why:) of previous case that loaded the table by bulk INSERT's. However, comparing the schema load time (1.9s vs 247s), the 5 times less checkpoint number seems not a major factor. I feel, elimination of numerous fseeks/freads from the for loop is.
Of course, though this new file format can save much time on cold starting real BIG tables, it has no backward compatibility, so it's only for reference.
Before this experimental file format, i also tried parallelizing the for-loop. It didn't improve at all. More threads (multiplied by the thread count initiated by FileMgr::init) competing for disk i/o made the situation even worse; system load constantly shoot to 30+ without throughput gain.
Due to no backward compatibility (unless code tuned to accept dual formats) and any side effect yet to know, a PR for this change seems improper for now. A diff of code is here for review only if interesting:
$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100644
new mode 100755
index 4bf5e93..9dddb54
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -239,7 +239,7 @@ add_library(mapd_thrift
${CMAKE_BINARY_DIR}/gen-cpp/MapD.h
${CMAKE_BINARY_DIR}/gen-cpp/mapd_constants.cpp
${CMAKE_BINARY_DIR}/gen-cpp/mapd_types.cpp)
-target_link_libraries(mapd_thrift ${Thrift_LIBRARIES})
+target_link_libraries(mapd_thrift ${Thrift_LIBRARIES} tbb)
option(ENABLE_JOIN_EXEC "Enable RA vm to execute join node" ON)
if(ENABLE_JOIN_EXEC)
@@ -369,11 +369,11 @@ add_custom_target(rerun_cmake ALL
)
add_dependencies(mapd_server rerun_cmake)
-target_link_libraries(mapd_server mapd_thrift thrift_handler ${MAPD_LIBRARIES} ${Boost_LIBRARIES} ${Glog_LIBRARIES} ${CMAKE_DL_LIBS} ${CUDA_LIBRARIES} ${LLVM_LINKER_FLAGS} ${PROFILER_LIBS} ${CURSES_LIBRARIES} ${ZLIB_LIBRARIES} poly2tri)
+target_link_libraries(mapd_server mapd_thrift thrift_handler ${MAPD_LIBRARIES} ${Boost_LIBRARIES} ${Glog_LIBRARIES} ${CMAKE_DL_LIBS} ${CUDA_LIBRARIES} ${LLVM_LINKER_FLAGS} ${PROFILER_LIBS} ${CURSES_LIBRARIES} ${ZLIB_LIBRARIES} poly2tri tbb)
if(ENABLE_FOLLY)
-target_link_libraries(initdb Shared Catalog Fragmenter Chunk SqliteConnector DataMgr StringDictionary ${Boost_LIBRARIES} ${Folly_LIBRARIES} ${CMAKE_DL_LIBS})
+target_link_libraries(initdb Shared Catalog Fragmenter Chunk SqliteConnector DataMgr StringDictionary ${Boost_LIBRARIES} ${Folly_LIBRARIES} ${CMAKE_DL_LIBS} tbb)
else()
-target_link_libraries(initdb Shared Catalog Fragmenter Chunk SqliteConnector DataMgr StringDictionary ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
+target_link_libraries(initdb Shared Catalog Fragmenter Chunk SqliteConnector DataMgr StringDictionary ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} tbb)
endif()
macro(set_dpkg_arch arch_in arch_out)
diff --git a/DataMgr/FileMgr/File.cpp b/DataMgr/FileMgr/File.cpp
old mode 100644
new mode 100755
index bdfc009..147cff6
--- a/DataMgr/FileMgr/File.cpp
+++ b/DataMgr/FileMgr/File.cpp
@@ -42,12 +42,12 @@ FILE* create(const std::string& basePath, const int fileId, const size_t pageSiz
if (f == nullptr) {
LOG(FATAL) << "Error trying to create file '" << path << "', the errno is " << errno;
}
- fseek(f, (pageSize * numPages) - 1, SEEK_SET);
+ fseek(f, SUPER_PAGE_SIZE + (pageSize * numPages) - 1, SEEK_SET);
fputc(EOF, f);
fseek(f, 0, SEEK_SET); // rewind
- if (fileSize(f) != pageSize * numPages) {
+ if (fileSize(f) != SUPER_PAGE_SIZE + pageSize * numPages) {
LOG(FATAL) << "Error trying to create file '" << path << "', file size " << fileSize(f)
- << " does not equal pageSize * numPages " << pageSize * numPages;
+ << " does not equal pageSize * numPages " << SUPER_PAGE_SIZE + pageSize * numPages;
}
return f;
@@ -62,12 +62,12 @@ FILE* create(const std::string& fullPath, const size_t requestedFileSize) {
if (f == nullptr) {
LOG(FATAL) << "Error trying to create file '" << fullPath << "', the errno is " << errno;
}
- fseek(f, requestedFileSize - 1, SEEK_SET);
+ fseek(f, SUPER_PAGE_SIZE + requestedFileSize - 1, SEEK_SET);
fputc(EOF, f);
fseek(f, 0, SEEK_SET); // rewind
- if (fileSize(f) != requestedFileSize) {
+ if (fileSize(f) != SUPER_PAGE_SIZE + requestedFileSize) {
LOG(FATAL) << "Error trying to create file '" << fullPath << "', file size " << fileSize(f)
- << " does not equal requestedFileSize " << requestedFileSize;
+ << " does not equal requestedFileSize " << SUPER_PAGE_SIZE + requestedFileSize;
}
return f;
}
@@ -122,7 +122,7 @@ size_t append(FILE* f, const size_t size, int8_t* buf) {
}
size_t readPage(FILE* f, const size_t pageSize, const size_t pageNum, int8_t* buf) {
- return read(f, pageNum * pageSize, pageSize, buf);
+ return read(f, SUPER_PAGE_SIZE + pageNum * pageSize, pageSize, buf);
}
size_t readPartialPage(FILE* f,
@@ -131,11 +131,11 @@ size_t readPartialPage(FILE* f,
const size_t readSize,
const size_t pageNum,
int8_t* buf) {
- return read(f, pageNum * pageSize + offset, readSize, buf);
+ return read(f, SUPER_PAGE_SIZE + pageNum * pageSize + offset, readSize, buf);
}
size_t writePage(FILE* f, const size_t pageSize, const size_t pageNum, int8_t* buf) {
- return write(f, pageNum * pageSize, pageSize, buf);
+ return write(f, SUPER_PAGE_SIZE + pageNum * pageSize, pageSize, buf);
}
size_t writePartialPage(FILE* f,
@@ -144,7 +144,7 @@ size_t writePartialPage(FILE* f,
const size_t writeSize,
const size_t pageNum,
int8_t* buf) {
- return write(f, pageNum * pageSize + offset, writeSize, buf);
+ return write(f, SUPER_PAGE_SIZE + pageNum * pageSize + offset, writeSize, buf);
}
size_t appendPage(FILE* f, const size_t pageSize, int8_t* buf) {
diff --git a/DataMgr/FileMgr/File.h b/DataMgr/FileMgr/File.h
old mode 100644
new mode 100755
index 3943f4e..b41d262
--- a/DataMgr/FileMgr/File.h
+++ b/DataMgr/FileMgr/File.h
@@ -33,6 +33,15 @@
namespace File_Namespace {
+//ppan# moved from FileBuffer.cpp
+#define METADATA_PAGE_SIZE 4096
+
+//ppan+ this super page resides at front of a file and must
+//be big enough to hold 'headers' of maximum number of 'pages'.
+#define SUPER_PAGE_SIZE (1 << 18)
+#define SUPER_HEAD_SIZE (SUPER_PAGE_SIZE / METADATA_PAGE_SIZE)
+
+
FILE* create(const std::string& basePath, const int fileId, const size_t pageSize, const size_t npages);
FILE* create(const std::string& fullPath, const size_t requestedFileSize);
diff --git a/DataMgr/FileMgr/FileBuffer.cpp b/DataMgr/FileMgr/FileBuffer.cpp
old mode 100644
new mode 100755
index 6b45434..4d64584
--- a/DataMgr/FileMgr/FileBuffer.cpp
+++ b/DataMgr/FileMgr/FileBuffer.cpp
@@ -28,8 +28,6 @@
#include <thread>
#include <future>
-#define METADATA_PAGE_SIZE 4096
-
using namespace std;
namespace File_Namespace {
@@ -151,6 +149,10 @@ void FileBuffer::calcHeaderBuffer() {
if (headerMod > 0) {
reservedHeaderSize_ += headerBufferOffset_ - headerMod;
}
+
+ //ppan+ no need this in new format !!!
+ reservedHeaderSize_ = 0;
+
// pageDataSize_ = pageSize_-reservedHeaderSize_;
}
@@ -356,12 +358,12 @@ void FileBuffer::writeHeader(Page& page, const int pageId, const int epoch, cons
header[intHeaderSize - 1] = epoch;
FileInfo* fileInfo = fm_->getFileInfoForFileId(page.fileId);
size_t pageSize = writeMetadata ? METADATA_PAGE_SIZE : pageSize_;
- fileInfo->write(page.pageNum * pageSize, (intHeaderSize) * sizeof(int), (int8_t*)&header[0]);
+ fileInfo->write(page.pageNum * SUPER_HEAD_SIZE - SUPER_PAGE_SIZE, (intHeaderSize) * sizeof(int), (int8_t*)&header[0]);
}
void FileBuffer::readMetadata(const Page& page) {
FILE* f = fm_->getFileForFileId(page.fileId);
- fseek(f, page.pageNum * METADATA_PAGE_SIZE + reservedHeaderSize_, SEEK_SET);
+ fseek(f, SUPER_PAGE_SIZE + page.pageNum * METADATA_PAGE_SIZE + reservedHeaderSize_, SEEK_SET);
fread((int8_t*)&pageSize_, sizeof(size_t), 1, f);
fread((int8_t*)&size_, sizeof(size_t), 1, f);
vector<int> typeData(
@@ -390,7 +392,7 @@ void FileBuffer::writeMetadata(const int epoch) {
Page page = fm_->requestFreePage(METADATA_PAGE_SIZE, true);
writeHeader(page, -1, epoch, true);
FILE* f = fm_->getFileForFileId(page.fileId);
- fseek(f, page.pageNum * METADATA_PAGE_SIZE + reservedHeaderSize_, SEEK_SET);
+ fseek(f, SUPER_PAGE_SIZE + page.pageNum * METADATA_PAGE_SIZE + reservedHeaderSize_, SEEK_SET);
fwrite((int8_t*)&pageSize_, sizeof(size_t), 1, f);
fwrite((int8_t*)&size_, sizeof(size_t), 1, f);
vector<int> typeData(
diff --git a/DataMgr/FileMgr/FileInfo.cpp b/DataMgr/FileMgr/FileInfo.cpp
old mode 100644
new mode 100755
index a7ec847..83cc2ce
--- a/DataMgr/FileMgr/FileInfo.cpp
+++ b/DataMgr/FileMgr/FileInfo.cpp
@@ -19,6 +19,7 @@
#include "Page.h"
#include <glog/logging.h>
#include <iostream>
+#include <memory>
#include <utility>
using namespace std;
@@ -45,19 +46,19 @@ void FileInfo::initNewFile() {
int headerSize = 0;
int8_t* headerSizePtr = (int8_t*)(&headerSize);
for (size_t pageId = 0; pageId < numPages; ++pageId) {
- File_Namespace::write(f, pageId * pageSize, sizeof(int), headerSizePtr);
+ File_Namespace::write(f, pageId * SUPER_HEAD_SIZE, sizeof(int), headerSizePtr);
freePages.insert(pageId);
}
}
size_t FileInfo::write(const size_t offset, const size_t size, int8_t* buf) {
std::lock_guard<std::mutex> lock(readWriteMutex_);
- return File_Namespace::write(f, offset, size, buf);
+ return File_Namespace::write(f, SUPER_PAGE_SIZE + offset, size, buf);
}
size_t FileInfo::read(const size_t offset, const size_t size, int8_t* buf) {
std::lock_guard<std::mutex> lock(readWriteMutex_);
- return File_Namespace::read(f, offset, size, buf);
+ return File_Namespace::read(f, SUPER_PAGE_SIZE + offset, size, buf);
}
void FileInfo::openExistingFile(std::vector<HeaderInfo>& headerVec, const int fileMgrEpoch) {
@@ -66,11 +67,15 @@ void FileInfo::openExistingFile(std::vector<HeaderInfo>& headerVec, const int fi
int oldPageId = -99;
int oldVersionEpoch = -99;
int skipped = 0;
+
+ //ppan+ read the whole super page to memory
+ std::unique_ptr<int8_t> spage(new int8_t[SUPER_PAGE_SIZE]);
+ size_t nread = pread(fileno(f), spage.get(), SUPER_PAGE_SIZE, 0);
+
for (size_t pageNum = 0; pageNum < numPages; ++pageNum) {
- int headerSize;
- fseek(f, pageNum * pageSize, SEEK_SET);
- fread((int8_t*)(&headerSize), sizeof(int), 1, f);
- if (headerSize != 0) {
+ int* ip = (int*)(spage.get() + pageNum * SUPER_HEAD_SIZE);
+ int headerSize = *ip++;
+ if (headerSize != 0 && pageNum < nread / SUPER_HEAD_SIZE) {
// headerSize doesn't include headerSize itself
// We're tying ourself to headers of ints here
size_t numHeaderElems = headerSize / sizeof(int);
@@ -83,11 +88,12 @@ void FileInfo::openExistingFile(std::vector<HeaderInfo>& headerVec, const int fi
// size_t chunkSize;
// We don't want to read headerSize in our header - so start
// reading 4 bytes past it
- fread((int8_t*)(&chunkKey[0]), headerSize - 2 * sizeof(int), 1, f);
+ for (int i = 0; i < (int)((headerSize - 2 * sizeof(int)) / sizeof(int)); ++i)
+ chunkKey[i] = *ip++;
// cout << "Chunk key: " << showChunk(chunkKey) << endl;
- fread((int8_t*)(&pageId), sizeof(int), 1, f);
+ pageId = *ip++;
// cout << "Page id: " << pageId << endl;
- fread((int8_t*)(&versionEpoch), sizeof(int), 1, f);
+ versionEpoch = *ip++;
if (chunkKey != oldChunkKey || oldPageId != pageId - (1 + skipped)) {
if (skipped > 0) {
VLOG(1) << "\tChunk key: " << showChunk(oldChunkKey) << " Page id from : " << oldPageId
@@ -118,7 +124,7 @@ void FileInfo::openExistingFile(std::vector<HeaderInfo>& headerVec, const int fi
// First write 0 to first four bytes of
// header to mark as free
headerSize = 0;
- File_Namespace::write(f, pageNum * pageSize, sizeof(int), (int8_t*)&headerSize);
+ File_Namespace::write(f, pageNum * SUPER_HEAD_SIZE, sizeof(int), (int8_t*)&headerSize);
// Now add page to free list
freePages.insert(pageNum);
LOG(WARNING) << "Was not checkpointed: Chunk key: " << showChunk(chunkKey) << " Page id: " << pageId
@@ -148,7 +154,7 @@ void FileInfo::openExistingFile(std::vector<HeaderInfo>& headerVec, const int fi
void FileInfo::freePage(int pageId) {
int zeroVal = 0;
int8_t* zeroAddr = reinterpret_cast<int8_t*>(&zeroVal);
- File_Namespace::write(f, pageId * pageSize, sizeof(int), zeroAddr);
+ File_Namespace::write(f, pageId * SUPER_HEAD_SIZE, sizeof(int), zeroAddr);
std::lock_guard<std::mutex> lock(freePagesMutex_);
freePages.insert(pageId);
}
diff --git a/DataMgr/FileMgr/FileInfo.h b/DataMgr/FileMgr/FileInfo.h
old mode 100644
new mode 100755
diff --git a/DataMgr/FileMgr/FileMgr.cpp b/DataMgr/FileMgr/FileMgr.cpp
old mode 100644
new mode 100755
index 0de7622..0da768c
--- a/DataMgr/FileMgr/FileMgr.cpp
+++ b/DataMgr/FileMgr/FileMgr.cpp
@@ -147,8 +147,8 @@ void FileMgr::init(const size_t num_reader_threads) {
size_t pageSize = boost::lexical_cast<size_t>(fileStem.substr(dotPos + 1, fileStem.size()));
std::string filePath(fileIt->path().string());
size_t fileSize = boost::filesystem::file_size(filePath);
- assert(fileSize % pageSize == 0); // should be no partial pages
- size_t numPages = fileSize / pageSize;
+ assert((fileSize - SUPER_PAGE_SIZE) % pageSize == 0); // should be no partial pages
+ size_t numPages = (fileSize - SUPER_PAGE_SIZE) / pageSize;
VLOG(1) << "File id: " << fileId << " Page size: " << pageSize << " Num pages: " << numPages;
@@ -301,8 +301,8 @@ void FileMgr::init(const std::string dataPathToConvertFrom) {
size_t pageSize = boost::lexical_cast<size_t>(fileStem.substr(dotPos + 1, fileStem.size()));
std::string filePath(fileIt->path().string());
size_t fileSize = boost::filesystem::file_size(filePath);
- assert(fileSize % pageSize == 0); // should be no partial pages
- size_t numPages = fileSize / pageSize;
+ assert((fileSize - SUPER_PAGE_SIZE) % pageSize == 0); // should be no partial pages
+ size_t numPages = (fileSize - SUPER_PAGE_SIZE) / pageSize;
file_futures.emplace_back(std::async(std::launch::async, [filePath, fileId, pageSize, numPages, this] {
std::vector<HeaderInfo> tempHeaderVec;
Forgot to rerun the query that needs a smaller column. Quoted:
Such a guess can be foiled by a different query that needs a smaller-size column than medallion column. For example, to complete the following query on cold start:
select count(*) from (select max(pickup_datetime) from trips prewhere dropoff_datetime = '2014-04-23
03:17:00' group by dropoff_datetime)
MapD uses 5m55s; CH uses 22s. After warm up, both databases took almost the same time (<1s) to finish 2nd+ instances of the query.
For that query, with new file format, after cold start (all file cache was cleared) the time used are very close now (26s vs 22s):
$ time echo "select count(*) from (select max(pickup_datetime) from trips where dropoff_datetime = '2014-04-23 03:17:00' group by dropoff_datetime);" | /mnt/mapd-core/bin/mapdql mapd -u $MAPD_US
ERNAME -p $MAPD_PASSWORD
User mapd connected to database mapd
EXPR$0
1
User mapd disconnected from database mapd
real 0m26.083s
user 0m0.004s
sys 0m0.004s
$ tail -f /mnt/trip/mapd/data/mapd_log/mapd_server.INFO
E1009 16:54:06.409965 5376 MapDHandler.cpp:142] This build isn't CUDA enabled, will run on CPU
I1009 16:54:06.411263 5376 DataMgr.cpp:120] cpuSlabSize is 4096M
I1009 16:54:06.427644 5376 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 0ms Epoch: 0 files read: 0 table location: '/mnt/trip/mapd/data/mapd_data/table_0_0/'
I1009 16:54:06.430061 5376 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1009 16:54:06.430079 5376 Calcite.cpp:95] Running calcite server as a daemon
I1009 16:54:07.088037 5376 Calcite.cpp:124] Calcite server start took 600 ms
I1009 16:54:07.088114 5376 Calcite.cpp:125] ping took 29 ms
I1009 16:54:07.100267 5376 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1009 16:54:07.105474 5376 MapDHandler.cpp:174] No GPUs detected, falling back to CPU mode
I1009 16:54:07.105518 5376 MapDHandler.cpp:183] Started in CPU mode
I1009 16:55:14.112300 5397 MapDHandler.cpp:314] User mapd connected to database mapd
I1009 16:55:14.149191 5397 MapDHandler.cpp:2181] select count(*) from (select max(pickup_datetime) from trips where dropoff_datetime = '2014-04-23 03:17:00' group by dropoff_datetime);
I1009 16:55:14.154332 5397 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where dropoff_datetime = '2014-04-23 03:17:00' group by dropoff_datetime);'
I1009 16:55:17.068141 5399 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 1943ms Epoch: 3920 files read: 94 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1009 16:55:26.862198 5399 Catalog.cpp:1510] Instantiating Fragmenter for table trips took 11778ms
I1009 16:55:26.993620 5399 Catalog.cpp:1556] Time to load Dictionary 1 was 131ms
I1009 16:55:27.062726 5399 Catalog.cpp:1556] Time to load Dictionary 2 was 69ms
I1009 16:55:27.149145 5399 Catalog.cpp:1556] Time to load Dictionary 3 was 86ms
I1009 16:55:27.211570 5399 Catalog.cpp:1556] Time to load Dictionary 4 was 62ms
I1009 16:55:27.508219 5397 Calcite.cpp:260] Time in Thrift 17 (ms), Time in Java Calcite server 13336 (ms)
I1009 16:55:27.525780 5397 RelAlgOptimizer.cpp:301] ID=5 (RelProject<140323225614192> (RexInput 1 140323225613888)) deleted!
I1009 16:55:27.526129 5397 RelAlgOptimizer.cpp:707] (RelProject<140323225547296> (RexInput 6 140323225548000) (RexInput 5 140323225548000)) eliminated 1 columns.
I1009 16:55:27.526198 5397 RelAlgOptimizer.cpp:707] (RelAggregate<140323225613888>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1009 16:55:27.984529 7663 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1009 16:55:39.693989 5397 MapDHandler.cpp:2279] Total: 25544 (ms), Execution: 25543 (ms)
I1009 16:55:39.694561 5397 MapDHandler.cpp:324] User mapd disconnected from database mapd
FYI, Michael's off today for Canadian holiday.
Hi @fleapapa, would you mind making a PR for this so we can try it out more easily?
Hi @tmostak, no problem on the PR, but to not have different code changes mixed in one PR, i will need to stash the changes for this issue and make a PR for issue #105 first.
By the way, due to #105, the data files currently in my database were created all through COPY statements, so there are not many checkpoints for double checking this issue. Once done with #105, i will re-load the database using bulk INSERT, which will create x5 checkpoints for double checking the issue. INSERT is relatively slower. It may be hours to pump 0.5B rows into the db. Will make the PR for this issue a little later.
Finally had 0.5B rows be INSERT-ed to the table. Number of checkpoints created is 507, similar to the number that @dwayneberry saw last time. This time, immediately after cold start and file cache was cleared, mapd core took 13s to load the table schema and took 5m47s to finish the same query.
E1011 23:00:33.947511 568 MapDHandler.cpp:142] This build isn't CUDA enabled, will run on CPU
I1011 23:00:33.947810 568 DataMgr.cpp:120] cpuSlabSize is 4096M
I1011 23:00:33.983031 568 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 15ms Epoch: 0 files read: 0 table location: '/mnt/trip/mapd/data/mapd_data/table_0_0/'
I1011 23:00:34.003734 568 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1011 23:00:34.003762 568 Calcite.cpp:95] Running calcite server as a daemon
I1011 23:00:34.860302 568 Calcite.cpp:124] Calcite server start took 800 ms
I1011 23:00:34.860373 568 Calcite.cpp:125] ping took 29 ms
I1011 23:00:34.866739 568 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1011 23:00:34.867075 568 MapDHandler.cpp:174] No GPUs detected, falling back to CPU mode
I1011 23:00:34.867102 568 MapDHandler.cpp:183] Started in CPU mode
I1011 23:01:25.598544 589 MapDHandler.cpp:314] User mapd connected to database mapd
I1011 23:01:25.644287 589 MapDHandler.cpp:2181] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1011 23:01:25.645490 589 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1011 23:01:39.569141 591 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 13031ms Epoch: 125156 files read: 505 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1011 23:06:35.585868 591 Catalog.cpp:1510] Instantiating Fragmenter for table trips took 309048ms
I1011 23:06:35.702114 591 Catalog.cpp:1556] Time to load Dictionary 1 was 116ms
I1011 23:06:35.838363 591 Catalog.cpp:1556] Time to load Dictionary 2 was 136ms
I1011 23:06:35.959408 591 Catalog.cpp:1556] Time to load Dictionary 3 was 120ms
I1011 23:06:36.064339 591 Catalog.cpp:1556] Time to load Dictionary 4 was 104ms
I1011 23:06:36.438885 589 Calcite.cpp:260] Time in Thrift 13 (ms), Time in Java Calcite server 310780 (ms)
I1011 23:06:36.439460 589 RelAlgOptimizer.cpp:301] ID=5 (RelProject<140736683325296> (RexInput 1 140736683325024)) deleted!
I1011 23:06:36.439644 589 RelAlgOptimizer.cpp:707] (RelProject<140736683258448> (RexInput 0 140736683259184) (RexInput 5 140736683259184)) eliminated 1 columns.
I1011 23:06:36.439684 589 RelAlgOptimizer.cpp:707] (RelAggregate<140736683325024>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1011 23:06:36.517798 3481 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1011 23:07:12.918454 589 MapDHandler.cpp:2279] Total: 347273 (ms), Execution: 347273 (ms)
I1011 23:07:12.918908 589 MapDHandler.cpp:324] User mapd disconnected from database mapd
It seems @dwayneberry is correct and i am wrong. Huh,,, the number of checkpoints is the major factor of the slowness???
Let me restore to old file format and double check it again. Sorry, this needs another 10+ hours to INSERT the 0.5B row in old format...
While i'm re-injecting 512M rows in old file format, from number of created files and table row count it is observed that average one checkpoint is created for every 1M rows.
173
User mapd connected to database mapd
EXPR$0
173179759
If a larger number of checkpoints (INSERT vs COPY) is the root cause of slowness, does it make sense to reduce checkpoint rate if it won't have any negative impact? For most online systems using INSERT to inject data should be more frequently seen than using COPY.
After INSERT of 512M rows in old file format, i cleared file cache and cold started mapd_server to do the same query. INFO log is attached below. Here is the result, with comparison to alternative file format.
Metadata load time: 208s (vs. 13s)
Fragmenter initialization: 219s (vs. 309s)
Time in Calcite server: 221s (vs. 310s)
Total time: 327s (vs. 347s)
Overall, existing file format delivers better performance.
I'm very curious why the alternative format won ~200s on loading metadata but lost ~100s on fragmenter initialization. (There must be somewhere else in existing code that runs less efficiently on the alternative format, which may be optimizable.)
Also, how is the total time summed up???
$ tail -f /mnt/trip/mapd/data/mapd_log/mapd_server.INFO
E1012 18:04:27.619213 29994 MapDHandler.cpp:142] This build isn't CUDA enabled, will run on CPU
I1012 18:04:27.619338 29994 DataMgr.cpp:120] cpuSlabSize is 4096M
I1012 18:04:27.623152 29994 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 0ms Epoch: 0 files read: 0 table location: '/mnt/trip/mapd/data/mapd_data/table_0_0/'
I1012 18:04:27.634676 29994 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1012 18:04:27.634690 29994 Calcite.cpp:95] Running calcite server as a daemon
I1012 18:04:28.381011 29994 Calcite.cpp:124] Calcite server start took 700 ms
I1012 18:04:28.381088 29994 Calcite.cpp:125] ping took 26 ms
I1012 18:04:28.386425 29994 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1012 18:04:28.386762 29994 MapDHandler.cpp:174] No GPUs detected, falling back to CPU mode
I1012 18:04:28.386793 29994 MapDHandler.cpp:183] Started in CPU mode
I1012 18:05:27.368151 30015 MapDHandler.cpp:314] User mapd connected to database mapd
I1012 18:05:27.410347 30015 MapDHandler.cpp:2181] select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion;
I1012 18:05:27.417311 30015 Calcite.cpp:247] User mapd catalog mapd sql 'select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion;'
I1012 18:08:56.181397 30017 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 207856ms Epoch: 125234 files read: 506 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1012 18:09:07.915644 30017 Catalog.cpp:1510] Instantiating Fragmenter for table trips took 219592ms
I1012 18:09:08.082088 30017 Catalog.cpp:1556] Time to load Dictionary 1 was 166ms
I1012 18:09:08.197427 30017 Catalog.cpp:1556] Time to load Dictionary 2 was 115ms
I1012 18:09:08.312327 30017 Catalog.cpp:1556] Time to load Dictionary 3 was 114ms
I1012 18:09:08.434015 30017 Catalog.cpp:1556] Time to load Dictionary 4 was 121ms
I1012 18:09:08.708822 30015 Calcite.cpp:260] Time in Thrift 11 (ms), Time in Java Calcite server 221280 (ms)
I1012 18:09:09.127109 32695 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1012 18:10:16.663326 32701 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1012 18:10:55.029428 30015 MapDHandler.cpp:2279] Total: 327618 (ms), Execution: 327586 (ms)
I1012 18:10:55.063760 30015 MapDHandler.cpp:324] User mapd disconnected from database mapd
@fleapapa The total time is gathered via a stop watch in the outer layer of the query it is not a sum. It counts total wall clock.
I suspect you are trying to optimize something were we have assumed the bottom layer is SSD so fseek is cheap and you are using HDD trying to do bulk reads. Ultimately the data needs to get read.
There is no doubt there are gains to be had here but the low hanging fruit in my opinion is around management of old epoch and trying to keep the metadata trim. I am just in the process of landing a change so a single import creates a single epoch step to reduce the bloat, also allowing a failed load to not leave remnants of the partially processed files.
Thanks for all your review here much appreciated
Ultimately the data needs to get read, but i'm very curious why reading a contiguous layout of the same data set needs 200 seconds more than reading a disjoint one. I will try to figure it out later.
Also, if i understand it correctly, though each page header has only 24 bytes, FILE api internal should buffer a few disk blocks in memory, so fseek for consecutive headers on HDD shouldn't be much more expensive than on SSD. I think the function call overhead of fseek for thousands of page headers can not be ignored.
@fleapapa I would have to review what changes you have made in more detail, (when there is a PR). If you are saying you have moved all the metadata into contiguous single reads then yes that does sound like a bit of mystery.
@dwayneberry. The mystery seemed from too small buffer size of FILE stream (8KB by default).
With larger FILE buffers (256KB), cold start query performance with the alternative file format is significantly improved to 2m8s (from previous 5m47s), as shown in INFO log below:
I1015 14:03:50.586053 21540 MapDServer.cpp:499] MapD started with data directory at '/mnt/trip/mapd/data'
I1015 14:03:50.595965 21540 MapDServer.cpp:506] Watchdog is set to 1
I1015 14:03:50.595984 21540 MapDServer.cpp:528] cuda block size 0
I1015 14:03:50.595995 21540 MapDServer.cpp:529] cuda grid size 0
I1015 14:03:50.596002 21540 MapDServer.cpp:530] calcite JVM max memory 1024
I1015 14:03:50.596009 21540 MapDServer.cpp:531] MapD Server Port 9091
I1015 14:03:50.596017 21540 MapDServer.cpp:532] MapD Calcite Port 9093
I1015 14:03:50.596055 21540 MapDHandler.cpp:132] MapD Server 3.3.1dev-20171015-9825207
E1015 14:03:50.596067 21540 MapDHandler.cpp:139] This build isn't CUDA enabled, will run on CPU
I1015 14:03:50.597515 21540 DataMgr.cpp:120] cpuSlabSize is 4096M
I1015 14:03:50.623394 21540 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 0ms Epoch: 0 files read: 0 table location: '/mnt/trip/mapd/data/mapd_data/table_0_0/'
I1015 14:03:50.626857 21540 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1015 14:03:50.626874 21540 Calcite.cpp:95] Running calcite server as a daemon
I1015 14:03:51.365985 21540 Calcite.cpp:124] Calcite server start took 700 ms
I1015 14:03:51.366039 21540 Calcite.cpp:125] ping took 25 ms
I1015 14:03:51.373345 21540 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1015 14:03:51.381986 21540 MapDHandler.cpp:171] No GPUs detected, falling back to CPU mode
I1015 14:03:51.382210 21540 MapDHandler.cpp:180] Started in CPU mode
I1015 14:04:13.307305 21567 MapDHandler.cpp:311] User mapd connected to database mapd
I1015 14:04:13.339038 21567 MapDHandler.cpp:2178] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1015 14:04:13.344303 21567 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1015 14:04:25.290477 21570 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 10967ms Epoch: 126207 files read: 510 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1015 14:05:44.873132 21570 Catalog.cpp:1511] Instantiating Fragmenter for table trips took 90572ms
I1015 14:05:45.408686 21570 Catalog.cpp:1557] Time to load Dictionary 1 was 535ms
I1015 14:05:45.480578 21570 Catalog.cpp:1557] Time to load Dictionary 2 was 71ms
I1015 14:05:45.531590 21570 Catalog.cpp:1557] Time to load Dictionary 3 was 50ms
I1015 14:05:45.603368 21570 Catalog.cpp:1557] Time to load Dictionary 4 was 71ms
I1015 14:05:45.905020 21567 Calcite.cpp:260] Time in Thrift 12 (ms), Time in Java Calcite server 92548 (ms)
I1015 14:05:45.921736 21567 RelAlgOptimizer.cpp:301] ID=5 (RelProject<140528377411440> (RexInput 1 140528377411168)) deleted!
I1015 14:05:45.922024 21567 RelAlgOptimizer.cpp:707] (RelProject<140528377344592> (RexInput 0 140528377345328) (RexInput 5 140528377345328)) eliminated 1 columns.
I1015 14:05:45.922116 21567 RelAlgOptimizer.cpp:707] (RelAggregate<140528377411168>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1015 14:05:46.259065 24188 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1015 14:06:20.879173 21567 MapDHandler.cpp:2276] Total: 127539 (ms), Execution: 127538 (ms)
I1015 14:06:20.879688 21567 MapDHandler.cpp:321] User mapd disconnected from database mapd
I also applied the same larger FILE buffer size to existing file format. Its cold start performance was improved to 4m30s (from 5m27s).
I1015 07:42:28.057013 19152 MapDServer.cpp:499] MapD started with data directory at '/mnt/trip/mapd/data'
I1015 07:42:28.067157 19152 MapDServer.cpp:506] Watchdog is set to 1
I1015 07:42:28.067178 19152 MapDServer.cpp:528] cuda block size 0
I1015 07:42:28.067189 19152 MapDServer.cpp:529] cuda grid size 0
I1015 07:42:28.067198 19152 MapDServer.cpp:530] calcite JVM max memory 1024
I1015 07:42:28.067204 19152 MapDServer.cpp:531] MapD Server Port 9091
I1015 07:42:28.067214 19152 MapDServer.cpp:532] MapD Calcite Port 9093
I1015 07:42:28.067253 19152 MapDHandler.cpp:132] MapD Server 3.3.1dev-20171015-9825207
E1015 07:42:28.067266 19152 MapDHandler.cpp:139] This build isn't CUDA enabled, will run on CPU
I1015 07:42:28.067566 19152 DataMgr.cpp:120] cpuSlabSize is 4096M
I1015 07:42:28.087728 19152 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 0ms Epoch: 0 files read: 0 table location: '/mnt/trip/mapd/data/mapd_data/table_0_0/'
I1015 07:42:28.099359 19152 Calcite.cpp:156] Creating Calcite Handler, Calcite Port is 9093 base data dir is /mnt/trip/mapd/data
I1015 07:42:28.099385 19152 Calcite.cpp:95] Running calcite server as a daemon
I1015 07:42:28.311195 19152 Calcite.cpp:124] Calcite server start took 200 ms
I1015 07:42:28.311240 19152 Calcite.cpp:125] ping took 9 ms
I1015 07:42:28.315544 19152 Calcite.cpp:281] [{"name":"Tan","ret":"double","args":["double"]},{"name":"Truncate__","ret":"float","args":["float","i32"]},{"name":"ln","ret":"double","args":["double"]},{"name":"distance_in_meters__","ret":"double","args":["float","float","float","float"]},{"name":"Floor__","ret":"float","args":["float"]},{"name":"Floor__2","ret":"i32","args":["i32"]},{"name":"Floor__3","ret":"i64","args":["i64"]},{"name":"Truncate","ret":"double","args":["double","i32"]},{"name":"Floor__1","ret":"i16","args":["i16"]},{"name":"radians","ret":"double","args":["double"]},{"name":"degrees","ret":"double","args":["double"]},{"name":"Ceil__","ret":"float","args":["float"]},{"name":"ln__","ret":"double","args":["float"]},{"name":"approx_distance_in_meters","ret":"double","args":["float","float","float","float"]},{"name":"Ceil__2","ret":"i32","args":["i32"]},{"name":"Ceil__1","ret":"i16","args":["i16"]},{"name":"Ceil__3","ret":"i64","args":["i64"]},{"name":"power","ret":"double","args":["double","double"]},{"name":"conv_4326_900913_x","ret":"double","args":["double"]},{"name":"conv_4326_900913_y","ret":"double","args":["double"]},{"name":"Atan","ret":"double","args":["double"]},{"name":"Floor","ret":"double","args":["double"]},{"name":"Log10","ret":"double","args":["double"]},{"name":"Truncate__1","ret":"i16","args":["i16","i32"]},{"name":"Truncate__2","ret":"i32","args":["i32","i32"]},{"name":"Log","ret":"double","args":["double"]},{"name":"Truncate__3","ret":"i64","args":["i64","i32"]},{"name":"Cos","ret":"double","args":["double"]},{"name":"Log__","ret":"double","args":["float"]},{"name":"Log10__","ret":"double","args":["float"]},{"name":"Asin","ret":"double","args":["double"]},{"name":"Cot","ret":"double","args":["double"]},{"name":"Tan__","ret":"double","args":["float"]},{"name":"distance_in_meters","ret":"double","args":["double","double","double","double"]},{"name":"round_to_digit","ret":"double","args":["double","i32"]},{"name":"Atan2","ret":"double","args":["double","double"]},{"name":"Acos","ret":"double","args":["double"]},{"name":"pi","ret":"double","args":[]},{"name":"Sin","ret":"double","args":["double"]},{"name":"Ceil","ret":"double","args":["double"]},{"name":"Exp","ret":"double","args":["double"]}]
E1015 07:42:28.315850 19152 MapDHandler.cpp:171] No GPUs detected, falling back to CPU mode
I1015 07:42:28.315876 19152 MapDHandler.cpp:180] Started in CPU mode
I1015 07:43:09.355892 19183 MapDHandler.cpp:311] User mapd connected to database mapd
I1015 07:43:09.404305 19183 MapDHandler.cpp:2178] select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);
I1015 07:43:09.410953 19183 Calcite.cpp:247] User mapd catalog mapd sql 'select count(*) from (select max(pickup_datetime) from trips where medallion = '04D107A378DC761FDA5E92362DCA24E3' group by medallion);'
I1015 07:46:44.071444 19186 FileMgr.cpp:173] Completed Reading table's file metadata, Elasped time : 213691ms Epoch: 125234 files read: 506 table location: '/mnt/trip/mapd/data/mapd_data/table_1_1/'
I1015 07:47:07.352939 19186 Catalog.cpp:1511] Instantiating Fragmenter for table trips took 236986ms
I1015 07:47:07.889114 19186 Catalog.cpp:1557] Time to load Dictionary 1 was 535ms
I1015 07:47:07.977069 19186 Catalog.cpp:1557] Time to load Dictionary 2 was 87ms
I1015 07:47:08.040977 19186 Catalog.cpp:1557] Time to load Dictionary 3 was 63ms
I1015 07:47:08.092468 19186 Catalog.cpp:1557] Time to load Dictionary 4 was 51ms
I1015 07:47:08.426224 19183 Calcite.cpp:260] Time in Thrift 28 (ms), Time in Java Calcite server 238987 (ms)
I1015 07:47:08.465507 19183 RelAlgOptimizer.cpp:301] ID=5 (RelProject<140512069957488> (RexInput 1 140512069957216)) deleted!
I1015 07:47:08.466078 19183 RelAlgOptimizer.cpp:707] (RelProject<140512069890640> (RexInput 0 140512069891376) (RexInput 5 140512069891376)) eliminated 1 columns.
I1015 07:47:08.466164 19183 RelAlgOptimizer.cpp:707] (RelAggregate<140512069957216>(groups: [ 0 ] aggs: [ (RexAgg 2 0 TIMESTAMP NONE 1) ]) eliminated 1 columns.
I1015 07:47:08.829241 21793 BufferMgr.cpp:266] ALLOCATION slab of 8388608 pages (4294967296B) created in 0 ms CPU_MGR:0
I1015 07:47:39.643321 19183 MapDHandler.cpp:2276] Total: 270238 (ms), Execution: 270220 (ms)
I1015 07:47:39.643931 19183 MapDHandler.cpp:321] User mapd disconnected from database mapd
Here comes another mystery... Why doesn't existing file format benefit from larger FILE buffers the same as alternative file format does??
If necessary, i can create a PR for this tentative change.
[UPDATE]: Result of 32KB/64KB file buffer size is good too. (2m27s/2m9s).
@fleapapa Without the PR it is hard to speculate but this probably makes sense as I believe you are now reading large contiguous blocks. The current format is only reading smaller page headers so maybe does not benefit as much.