postgresql - create million table in a database? -


i wanna create million double column tables.. tried create using java took 100 mbs of data converted 7gbs , took 20hrs complete it... using postgre sql before tried mysql, mysql worse .. there way create amount of tables using less space , time? horizontal partitioning work ?

i trying index rdf data fast execution, idea index rdf data using rdbms , transform sparql query sql query, rdf collection of resources in form of triples subject, predicate, object, existing methods use predicate tables means, each predicate, subject , object stored, amount of predicates less compared other 2. querying requires joining of these predicate tables in order results of order of 100mbs in flat files.i trying of creating subject tables 4 fast execution

if need million tables in database, you're doing wrong.

tables intended represent structurally , conceptually different data. , refuse believe you're operating million different concepts in application.

sometimes, beginners believe should create table per user, example. "a user" 1 concept, , store same information each user (name, email, username, password, example), ought one table, each user separate row.

it sounds you're making similar mistake, perhaps not users, other abstraction have lot of instances of. each instance should row in 1 single table.

if describe you're trying store in database, can figure out how should mapped tables.

edit
after reading comments (which should edited question itself), here thoughts:

if data structured same way (as triples), store in single table 3 columns, , add necessary indexes efficient lookups.

if predicates known in advance, could make table per predicate, i'm not sure how sense make, even.

the cleanest option have 4 tables:
(id, subject), (id, predicate) , (id, object),(subjectid, predicateid, objectid).


Comments