
Hi Ivan, if you declare foreign keys in your schema, MonetDB will automatically create and exploit foreign key indexes for foreign key joins. Without more information, e.g., your DB schema, data volume(s) and complete queries, I'm afraid we have no means to answer your vague questions more specifically. Best, Stefan On Tue, Dec 04, 2012 at 04:13:43PM -0300, Ivan Videla wrote:
Hi Stefan,
That was an example of a query that takes too much time. Really i want to make a join from 3 tables. Each table has a column reference to another. For example tableA.col1 = tableB.col1 and tableB.col2 = tableC.col2 . My question is because each table has a foreign key that holds that reference to next table. Anyway is taken more time than the same query running in mysql. So, I think that I am doing something wrong.
Regards,
Ivan
El 04-12-2012, a las 16:06, Stefan Manegold
escribió: Hi,
a simple multiplication plus global sum will be executed byt two simple scans, one over the two base column to calculate the multiplication and one over the multiplication result to calculate the sum. There is not need for or benefit from any index. MonetDB will caluculate the result as fast as your machine (CPU speed, memory size and speed, disk speed) allows.
Stefan
On Tue, Dec 04, 2012 at 03:52:10PM -0300, Ivan Videla wrote:
Hi All,
I have a table with 268 millions of records from supermarket transactions tran_id, prod_id, quantity, price, cost and i want to make a calculation like sum(quantity*(price-cost)). But this query takes too much time. I want to know if i can improve the results using an index. Or monetdb itself use an index on-the-fly. If not i would like to know how can i make an index to improve the execution time.
Regards, Ivan
-- | Stefan.Manegold @ CWI.nl | DB Architectures (INS1) | | http://CWI.nl/~manegold/ | Science Park 123 (L321) | | Tel.: +31 (0)20 592-4212 | 1098 XG Amsterdam (NL) | _______________________________________________ users-list mailing list users-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/users-list