I don’t know much about the database side, but I recommend the Data Explorer plugin which is an officially supported plugin, and this topic. (Best to start a new topic if you have new questions - others may benefit from the thread, and a suitable topic title will bring more help.)
Edit: perhaps see also
where there are hints of what the mechanism looks like and how you might query it.