Похожие чаты

I also have 2 other questions. Tl;dr, I have an

app that communicates with an SQL DB and the queries are quite slow, I'm trying to speed up the process because it's a mobile app.

1)
I made a data-type for the database entries:
public readonly struct DatabaseEntry
{
public readonly int Id;
public readonly DateTime Date;
public readonly TimeSpan OraIncepere;
public readonly TimeSpan OraFinal;
public readonly TimeSpan CursAlocat;
public readonly TimeSpan PregatireAlocat;
public readonly TimeSpan RecuperareAlocat;
public readonly TimeSpan Total;
public readonly string Observatii;
}

Should this be a class or a struct from an efficiency point of view?

2)
Are things in the connection string like:
Asynchronous Processing=true;Pooling=True;Min Pool Size=3;Max Pool Size=100;
relevant?

11 ответов

13 просмотров

your mobile app is connected directly to the db?

Kuran-Kaname Автор вопроса
ƒabio
your mobile app is connected directly to the db?

Yes. I know it's not a good practice and I should do http requests but I don't have the time right now to do that logic

Kuran Kaname
Yes. I know it's not a good practice and I should ...

Np my question is just to understand, i dont think you will speed up application in that way.. where it is slow? when pushing queries? maybe the connection is disposed and reopened every time. are you using async pattern?

From an effeciency point of view, structs are faster to create and destroy, but not to copy. Anyway I really wouldn't care that much and I'd rather use classes/structs for they're main difference: structs are a value-type while classes are references

Kuran-Kaname Автор вопроса
ƒabio
Np my question is just to understand, i dont think...

I'm doing an initial query to get all the elements from the DB and add them to a local list like: private async Task RefreshElementsAsync() => Entries = await _sql.GetAllElementsAsync().ConfigureAwait(false); —————————————— public async Task<List<DatabaseEntry>> GetAllElementsAsync() { IEnumerable<DatabaseEntry> result; await using (var conn = new SqlConnection(Secrets.ConnStr)) { result = await conn.QueryAsync<DatabaseEntry>($@"SELECT * FROM ""prezenta.{User}"""); } var elements = result.ToList(); return elements; } Using dapper btw

Kuran-Kaname Автор вопроса
Kuran Kaname
I'm doing an initial query to get all the elements...

The only solution I can think of is caching the entries in a json and reading them. I did this for the user accounts because it would take a long time to query if the account entered is correct . I cache them when the app first starts in a json file and read them from it

Kuran Kaname
I'm doing an initial query to get all the elements...

so the problem is only here? slow to get initial data?

Kuran-Kaname Автор вопроса
ƒabio
so the problem is only here? slow to get initial d...

Yes. Adding or deleting entries is quite instant

Kuran Kaname
Yes. Adding or deleting entries is quite instant

var elements = result.ToList(); to ToListAsync

Kuran-Kaname Автор вопроса
ƒabio
var elements = result.ToList(); to ToListAsync

Oh I had no idea that existed lol Adding it, thanks

Kuran Kaname
Oh I had no idea that existed lol Adding it, thank...

if QueryAsync retrieve the data, use ToList is ok, otherwise use tolistasync

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта