Re: Which database system?

2017-09-17 Thread Amirouche Boubekki
Le 15 sept. 2017 20:05, "Stefan Ram"  a écrit :

  When one is building an in-memory database that has a single
  table that is built at the start of the program and then one
  writes some complex queries to the table, what can be expected
  to be faster:

- implementing the table as a builtins.list of builtins.tuples
  with builtins.dicts as indexes for faster lookups and
  additional sorted builtins.lists for sorted "views" on the
  table

- implementing the table as a database table in sqlite3
  (":memory:") and using SQL commands for insertion


There is other solutions like shelve mentioned previously or plyvel (easy
api) or my preferred wiredtiger. But the issue with maintenance costs is
still valid. Choose the later if nothing else works.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which database system?

2017-09-15 Thread Chris Angelico
On Sat, Sep 16, 2017 at 11:37 AM, Steve D'Aprano
 wrote:
> On Sat, 16 Sep 2017 04:24 am, Chris Angelico wrote:
>
>> but switching your dict/list system to be
>> disk-backed is a lot harder.
>
> import shelve
>
> :-)
>
>
>
> Now you have two problems :-)
>

Yeah, like: How do you do a query (anything more complicated than
direct lookup) without loading everything into memory?

Though I had forgotten about shelve. It's not something I use often...
actually I don't think I've ever used it more than "hello world".

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Which database system?

2017-09-15 Thread Michael Torrie
On 09/15/2017 03:10 PM, Dennis Lee Bieber wrote:
>   "single table"  so no join logic needed. And I suspect the relational
> algebra "project" would be considered the same as SQL "select" by most
> folks 

As Stefan has said, it's sometimes useful to join a table with itself,
though I have never done that myself.

As for select and project, both are distinct operations and both
required.  In fact both operations are a part of the SQL "SELECT"
command.  The first bit, the list of fields, is the project part, and
the "WHERE" part is the select part, as well as the join part. Guess SQL
blurs the lines between the operations.  And my point was if he needs
those things then he's already reinvented the SQL SELECT, so he may as
well just use SQL.  Alternatively, use a LINQ-like library that
implements the relational algebra for him.  Sorry I was unclear.
-- 
https://mail.python.org/mailman/listinfo/python-list