0

With an SQLite database, I know I can do this to get the current size of the main database:

SELECT page_count * page_size as size FROM pragma_page_count(), pragma_page_size();

See also here (How to get the current sqlite database size or package size in Android?)

But how would I get the size of an attached database ?

In my case I have 'main' and an attached database 'db2' (ATTACH DATABASE 'something.db' as db2;) and I tried this:

SELECT page_count * page_size as size FROM db2.pragma_page_count(), db2.pragma_page_size();

but it just returns 0, even though I know something is there.

It's easy to find documentation on PRAGMA page_count; but I couldn't find much on pragma_page_count()

Bruno Leveque
  • 2,647
  • 2
  • 23
  • 33
Axel Podehl
  • 4,034
  • 29
  • 41

1 Answers1

0

Since they are user valued functions try sending the schema name as an argument (instead of a prefix).

DinoCoderSaurus
  • 6,110
  • 2
  • 10
  • 15