use of com.questdb.store.query.api.QueryHeadBuilder in project questdb by bluestreak01.
the class PerformanceTest method testLatestBySymbol.
@Test
public void testLatestBySymbol() throws JournalException, NumericException {
try (JournalWriter<Quote> w = getFactory().writer(Quote.class, null, TEST_DATA_SIZE)) {
TestUtils.generateQuoteData(w, TEST_DATA_SIZE, DateFormatUtils.parseDateTime("2013-10-05T10:00:00.000Z"), 1000);
w.commit();
}
try (Journal<Quote> journal = getFactory().reader(Quote.class)) {
int count = 1000000;
long t = 0;
QueryHeadBuilder qhb = journal.query().head().withKeys();
for (int i = -100000; i < count; i++) {
if (i == 0) {
t = System.nanoTime();
}
qhb.asResultSet().read();
}
LOG.info().$("journal.query().head().withKeys() (query+read) latency: ").$((System.nanoTime() - t) / count).$("ns").$();
}
}
Aggregations