[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Will lmdb suit my needs ?
- To: "openldap-technical@openldap.org" <openldap-technical@openldap.org>
- Subject: Will lmdb suit my needs ?
- From: Sankar P <sankar.curiosity@gmail.com>
- Date: Sun, 20 Jul 2014 13:47:24 +0530
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9jaWQzt/b6CP22SBZ0QP7fkQqCEAp82keTcMPqo7WKc=; b=SUFL8E/VzS/RYlpOqGtLnDFXAi7mO5da+HCwYNBwnn8ZOvA+N+Zg53eZjmiw0APPhg T1O7WrJtV6GMBuOHEn/AD9mNqHJbEMIv6bomWTdez/5GrExw8Dkpit+JfSEv1ODzpQ50 Ftqmr7xyS027sHllTKFZ7GWPG4fNlIWTAUUpXpf9/X7BH+auzsYq37igjIA/f64UMVo9 vUyPmxyu5u6NOpnqcvwlaDpqrJSzAwlY1rg2yErymeNiqIBKi77vKbkeZD50Mz/Ot9jA xswr06/ZWkwpCjeK2J2Vv+mRUQJ+nLjGYZDFGjwRRHS65PKMHekpdYNzY2uqXfgwpwMC 8PdQ==
Hi,
I have been using sqlite3 as the database for my application. My
application has three columns and about 10 million rows.
The query that I do is:
SELECT DISTINCT column2 FROM autocomplete WHERE column1 LIKE
'<prefix>%' ORDER BY column3 DESC LIMIT 5
where column1 and column2 are strings and column3 is int.
So, what my query essentially does is get a prefix string from user
and get the top (sorted by column3) 5 records where column1 start with
the input prefix and return the column2 of those records.
In my sqlite, the first time query for each key (a or b or c ...) is
taking about 350 seconds (with an index on all columns) and about 500
seconds (with an index on only column1).
The file size is about 800 MB for 1-column index and about 1.1 GB for
the sqlite db with an all column index.
Subsequent queries to the database with a pre-loaded prefix chars
(i.e., any second call with a search key a or b or c), return in
milliseconds.
My database will be constructed (written) only once and will be just
accessed (read) then after. There may not even be any updates/writes
after the construction.
I could not find any tutorial for lmdb by googling. I would prefer to
see some simple documentation that explains at least the basic set of
APIs that we need to use (say the lmdb equivalents of sqlite3_open,
sqlite3_exec, sqlite3_close)
Also, since I do not have much exposure to key-value dbs, will it be
possible to provide a custom compartor function for values (so that I
can store column2+column3 as a value and let the comparator function
use column3 only as a value compartor function) ?
Also one humble suggestion is that it may be better if the lmdb
sources could be moved to a separate git repo instead of as a branch
on the openldap git. That way it will be easier for potential
consumers of this library to easily google it and access/build the
sources.
Will lmdb be suitable for my needs ? And can someone point to any
tutorial ? Thanks.
--
Sankar P
http://psankar.blogspot.com