68 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yeah
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I can do that
but this happen when I changed my code to use in memory db
originally this is fine
Changing it back now is fine as well
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yes
So that is why I am seeking help of loading local db to memory properly
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I did a Backup
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
But I would like to load the entire db to memory and use it from there
What are you using in-memory for?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
That was basically what I did
But it does not seem to work
I backedup the data to memory
My understanding is in memory doesn't model a real database very well
I would stay away from it
I will only be reading
0 writing at all
so I would like to see if I can load it from memory to increase performance
What measuring have you done to show that that would actually boost perf?
I asked this question few days ago
I was suggested to use a profiler
the result was
1 a lot of linq query with the dbcontext
2 a lot of UI redraw
2 was solved
1 I did a predictionary
but I still want to see if I can get my db to be loaded to memory
That doesn't answer the question though
Just use a separate SQLite file
Separate sqlite file?
So you are implying EF core is not possible to load a file to memory?
I'm saying you shouldn't use in-memory, and should use SQLite like you already are
I want to improve the performance
And what makes you think this will have a notable impact?
Sure you spend a lot of time in the db
But in-memory isn't magic
why not?
file IO can't compare to something is in memory
should be common truth
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
20~30mb
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
I installed this nuget already; hence, I was able to use
UseInMemoryDatabase
methodAn in-memory database defeats the purpose of a database and doesn't make sense. If you want it in-memory, just make a List<yourDbEntity> or whatever. Query the db, retrieve every row, store them in your favorite collection, hooray you're in-memory
But they made this feature
highly disagree
an in memory database is more than ok - and it's absolutely different to just a list declared by yourself
idk I tend to trust MS on this one
The In-Memory provider was not designed for use outside of testing environments and should never be used as such.Which combined with the above quote also from MS, means it should just never be used
not at all
it's not for testing substitute of "relational databases"
and you seem to think my comment was specifically about EF Core In Memory, which it isn't. There are in memory database engines that work more efficiently than just a "list"
True, I thought you meant EF. What is the benefit of an in-memory db, then? And more efficiently than a list, sure... but a hashset or dictionary?
I was always under the impression the only real benefit of a db is when you have so much data that you can't fit it into memory
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Databases offer other features like ACID on disk
@D.Mentia
So how do you backup a local db to memory
What exactly are you trying to accomplish here
Do you want everything to be in memory but also persisted to disk
"backup a local db to memory" is odd terminology that doesn't make sense
And doesn't say anything about what the end goal is
KKSK@🌸🎵🌸🎵🌸#5391
I want to improve the performance
Quoted by
<@!446416451230760990> from #Load local db file to memory (click here)
React with ❌ to remove this embed.
KKSK@🌸🎵🌸🎵🌸#5391
file IO can't compare to something is in memory
Quoted by
<@!446416451230760990> from #Load local db file to memory (click here)
React with ❌ to remove this embed.
¯\_(ツ)_/¯
I doubt it'll make much difference personally
How about you write more efficient code
The DB isn't the problem
It's how you use it and the rest of the code that's the problem
As mentioned in the title; load a local db file to memory and use it (readonly needed)
Never asked for anything else
Readonly is not in the title
But if that's all you need, just load the data from the DB and cache it
That was what I did
But that was not my original question
I was asking specifically about this
You don't, that's not how it works
What would "load to memory" even mean?
Just stuffing the SQLite db into RAM? What would that accomplish?
And don't say "performance" without evidence that IO is your bottleneck
Because it's probably not
I am not sure what is the confusion here and why am I keep getting asked with same questions
But all I ever need since the beginning was load a local Db to memory and establish the connection
Because what you're trying to do makes no sense
That does not matter
Making sense doesn't matter?
$xy
The XY Problem
Asking about your attempted solution rather than your actual problem
Of course not
VFS have long been available; UseInMemoryDatabase was made with a nugget specifically for it
I understand how you hate about doing it as memory
But a feature is created with a purpose
So people can use it
You're asking a completely different question but you don't realize it
I am only asking to open a Db in memory and use it
And that's not how it works
That's why there's no answer
There is
Because I used it with external dll with vfs handle
OK so what is the problem then if you have it solved
Is fine if you do not know it
Because is an external dll; I want to know how to accomplish this without using external native library
Mount a ramdisk and copy your DB there
problem solved
To be honest if you don’t know the answer and is just opposing it I am not sure why you even bother for this long
Because that is the only option
But you don't want to listen
Multiple people are telling you the same thing
what answer?
You start by not providing anything and say that is not how you do it
Then you shifted to there is no answer
Most databases do not natively support loading the DB file into memory and working from there
Now you are saying load it to a RAM disk
So the only way you can make that work is to put it in a ramdisk which is still just fooling it by thinking it's on a real file system
But that still won't solve your speed problem because that's not the actual issue
You can blame the DB all you want but it's not the DB's fault
And if you put it in a ramdisk you have to be really sure you are only reading from it because it won't be persisted back to the actual disk
So then what's the point, if you want a read-only in memory cache of the data just read it from the DB and keep the data in process memory instead of copying the DB file to RAM and using it as a DB
Okay
here is the solution for anyone who might need it in the future
First you create a class that load the local db to your in memory db
Then in EF you just call the field
And yes as expected, the result is flying
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View