Delete rows from Berkeley DB using where condition - berkeley-db

I want to delete multiple rows from Berkeley DB using where condition. For example the query would be like this:
DELETE FROM table_name
WHERE [condition];
Is it possible to do?

Yes, you can use the BDB SQL Interface, which is compatible with SQLite's API, take a look at BDB SQL Is Nearly Identical to SQLite

Related

Use GenerateTableFetch processor for Teradata

We need to use GenerateTableFetch to fetch huge data from teradata using nifi. But since Teradata is not present as a database type it generate Limit keyword. I am able to replace it with Sample keyword. But sample everytime give random value so how can i use Nifi with Teradata for huge table?
Maybe try the "MS SQL 2008" adapter, it generates a TOP statement as well as a ROW_NUMBER() OVER clause. If that doesn't work, we'd need a TeradataDatabaseAdapter implementation, please feel free to file an improvement Jira as needed.

Querying database size in SQLite

Is there any way to query physical database size per table in SQLite?
In MySQL, there's a meta-table called information_schema.TABLES that lists physical table sizes in bytes. PostgreSQL has a similar meta-table called pg_tables. Is there anything like this in SQLite?
If you know where the database is, it's just a file. For example:
$ wc -c db/development.sqlite3
2338816 db/development.sqlite3
The sqlite3_analyzer tool outputs lots of information about a database, among them the amount of storage used by each table.

Distinct attribute value from Global Secondary Index in DynamoDB

How do we achieve the similar functionality of distinct keyword from SQL in Amazon DynamoDB?
dyanamo db is not support this kind of functionality, but you can achieve this in some ways (client side, lambda on dynamodb stream the updates another table with distinct values..)
you can find a good answer here: Retrieve distinct values from the hash key - DynamoDB

Multiple files for a single SQLite database

Afaik, SQLite stores a single database in a single file. Since this would decrease the performance when working with large databases, is it possible to explicitly tell SQLite not to store the whole DB in a single file and store different tables in different files instead?
I found out, that it is possible.
Use:
sqlite3.exe MainDB.db
ATTACH DATABASE 'SomeTableFile.db' AS stf;
Access the table from the other database file:
SELECT * FROM stf.SomeTable;
You can even join over several files:
SELECT *
FROM MainTable mt
JOIN stf.SomeTable st
ON (mt.id = st.mt_id);
https://www.sqlite.org/lang_attach.html
tameera said there is a limit of 62 attached databases but I never hit that limit so I can't confirm that.
The big advantage besides some special cases is that you limit the fragmentation in the database files and you can use the VACUUM command separately on each table!
If you don't need a join between these tables you can manually split the DB and say which tables are in which DB (=file).
I don't think that it's possible to let SQLite split your DB in multiple files, because you connect to a DB by telling the filename.
SQLite database files can grow quite large without any performance penalties.
The things that might degrade performance are:
file-locking contention
table size (if using indexes and issuing write queries)
Also, by default, SQLite limits the number of attached databases to 10.
Anyway, try partition your tables. You'll see that SQLite can grow enormously this way.

How to operate two SQLite databases in Android

I have two SQLite databases, and I want to do some operation to them (such as INNER JOIN). How can I do that?
Thanks,
Vincent
If you have 2 separate databases there are 2 main ways of tackling that:
1) Insert all (copy) the data into a single database, then query that.
2) Load all data into memory and manipulate it there.
Unless I'm missing it, there does not seem to be a "Linked Server" function (like in SQL Server) which would allow you to query them in a distributed manner.

Resources