Beispiel #1
0
                s.add(execStats[i])
            else:
                s.update(getAllStages(execStats[i]))
    elif type(execStats) == type([]):
        for i in execStats:
            s.update(getAllStages(i))
    return s


if __name__ == "__main__":
    p = Workload()
    mongo = Mongo()
    db = mongo.getDb()
    list_of_collections = db.list_collection_names()
    list_of_collections.sort()
    pipeline = p.getWorkload()
    f = open("list_operations.md", "w")
    for i in list_of_collections:
        f.write('## ')
        f.write(i)
        f.write('\n')
        f.write('\n')
        f.write('| Query | Operations |')
        f.write('\n')
        f.write('|---|---|')
        f.write('\n')
        for idx, j in enumerate(pipeline):
            q = Query(db, i, j)
            rs = q.getExecStats()
            operations = list(getAllStages(rs))
            f.write('| Query ' + str(idx) + '|' + ', '.join(operations) + '|')
Beispiel #2
0
from mongo import Mongo
from workload import Workload
from query import Query
import pandas as pd
from table import Table

if __name__ == "__main__":
    mongo = Mongo()
    db = mongo.getDb()
    list_of_collections = db.list_collection_names()
    workload = Workload()
    pipeline = workload.getWorkload()

    data = []
    for i in pipeline:
        dct = {}
        for j in list_of_collections:
            q = Query(db, j, i)
            dct[j] = q.getQueryExecTime()
        data.append(dct)
    df = pd.DataFrame(data)

    df_total = pd.DataFrame([dict(df.sum())])

    list_of_queries= []
    for i in range(len(pipeline)):
        list_of_queries.append('Query '+str(i+1))

    df['Query'] = list_of_queries
    df.set_index('Query', inplace=True)