Forum Stats

  • 3,816,120 Users
  • 2,259,147 Discussions
  • 7,893,392 Comments

Discussions

Why is one of the queries significant slower that the other?

We are developing an application using python and nosql . Using the OCI NoSQL service and NoSQL python SDK (borneo). We are querying a table with 407 rows using the two 2 queries below. The one shown below returns the result in a reasonable time

def time_base_query(handle, table_name,min_time_created):
    APP.app.logger.debug("Querying timebase data from NoSQL table: %s", table_name)
    try:
        statement = 'select * from ' + table_name + ' WHERE timeCreated >= CAST ("' + min_time_created + '"AS TIMESTAMP)'
        request = QueryRequest().set_statement(statement)
        while True:
            result = handle.query(request)
            if request.is_done():
                break
        return (result)
    except Exception as e:
        raise Exception('Unable to query a timebase record from table: {0} due to: {1}'.format(table_name, str(e))

and one below takes a lot of time to finish (Actually my bastion host is timing out while waiting for a response)

def query_all_from_table(handle, table_name):
    APP.app.logger.debug("Querying all data from NoSQL table: %s", table_name)
    try:
        statement = 'select * from ' + table_name
        request = QueryRequest().set_statement(statement)
        while True:
            result = handle.query(request)
            if request.is_done():
                break
        return (result)
    except Exception as e:
        raise Exception('Unable to delete record from table: {0} due to: {1}'.format(table_name, str(e)))

Does anyone have any ideas?

Answers