I need recommendations so that my query is faster it takes too much and apart the fragment, my table already contains millions of data, which is the best option for this type of case when there are millions of data. I already applied the creation of processes, index but still slow to do the query
pool = mp.Pool(processes=mp.cpu_count())
results = pool.map(filtar_query,json_f)
def filtar_query(args):
fecha, argumentos = args[0], args[1]
query = Modelo.objects.only('fecha','campo2','campo3').filter(fecha__date=fecha).filter(**argumentos).values('fecha','campo2','campo3')
df= pd.DataFrame(query)
df = df.groupby(fecha)
in the part where it takes too much time is to make the query that advice would give me