Search in sources :

Example 1 with QueryHeadBuilder

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").$();
    }
}
Also used : Quote(com.questdb.model.Quote) QueryHeadBuilder(com.questdb.store.query.api.QueryHeadBuilder) AbstractTest(com.questdb.test.tools.AbstractTest) Test(org.junit.Test)

Aggregations

Quote (com.questdb.model.Quote)1 QueryHeadBuilder (com.questdb.store.query.api.QueryHeadBuilder)1 AbstractTest (com.questdb.test.tools.AbstractTest)1 Test (org.junit.Test)1