On 08/06/2014 20:59, Montgomery-Smith, Stephen wrote:
> Why did the change the database structure?  The old way had a separate
> directory for each port/package built.  The new way is to use a modern
> relational database.  So one advantage is the the new pkg database is
> much faster.  Maybe there are other advantages too.

Yes, absolutely.  Speed is one very big reason for switching to sqlite.
There are others

    -  reliability.  It was depressingly easy to break the old style
       /var/db/pkg setup.  Especially in tracking reverse dependencies:
       ie. asking what depends on this package?

    -  consistency.  The database schema simply makes it impossible to
       have duplicate versions of the same package in the pkgdb,
       something that was formerly a frequent problem.

    -  It's a RDBMS with the power of SQL to pull out pretty much
       whatever information you could want about the packages you have
       installed.  SQL queries are much easier to write than grepping
       through /var/db/pkg and passing the results through some
       complicated post-processing pipeline to filter out the useful
       stuff.

Although one word of caution: we do tend to change the database schema
quite frequently, and occasionally in quite radical ways.  So, by all
means feel free to fire up 'pkg shell' and SQL away; just don't make
that an essential or even an important part of anything critical to your
livelihood.   Instead, use the tools like 'pkg query' or 'pkg info'
where we aim to provide a consistent API.

        Cheers,

        Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to