Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: exmdb usage stats for folders #32

Open
crpb opened this issue Oct 11, 2024 · 1 comment
Open

RFE: exmdb usage stats for folders #32

crpb opened this issue Oct 11, 2024 · 1 comment
Assignees

Comments

@crpb
Copy link
Contributor

crpb commented Oct 11, 2024

Just something for the future..

It would be nice to get those via api/cli aswell

  • mailcount/folder
  • size/folder

like in the counterpart

@jengelh jengelh changed the title FR: exmdb usage stats for folders RFE: exmdb usage stats for folders Oct 11, 2024
@crpb
Copy link
Contributor Author

crpb commented Feb 6, 2025

something like this

-- FOLDER LOOKUP VIEW VIA FOLDERS INCLUDING PARENT
DROP VIEW IF EXISTS temp.folderlist;
CREATE VIEW IF NOT EXISTS temp.folderlist
AS SELECT distinct(p.folder_id),
          p.parent_id,
          f1.propval AS foldername
     FROM folders p
     JOIN folder_properties f1
       ON f1.folder_id = p.folder_id
      AND f1.proptag = 805371935
    ORDER BY p.folder_id
;
-- MSGs/FOLDERSIZES
DROP VIEW IF EXISTS temp.messagecount;
CREATE VIEW IF NOT EXISTS temp.messagecount AS
SELECT fl.folder_id AS id,
       fl.foldername AS folder,
       SUM(m.message_size) as foldersize,
       count(m.message_id) AS count
  FROM folderlist fl
  LEFT JOIN messages m
    ON fl.folder_id = m.parent_fid
   AND m.is_deleted = 0
 WHERE fl.parent_id > 1
 GROUP BY fl.folder_id,
          fl.foldername
;
SELECT * FROM messagecount;

i already use those and other things, but would be gread to have a couple of VIEWS in the database by default 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants