![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi , I am new to MYSQL so here is a trivial question for you advanced users: I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. I'd appreciate any help. Thanks in advance. |
#3
| |||
| |||
|
|
On 11/6/2011 7:05 AM, Centrino wrote: Hi , I am new to MYSQL so here is a trivial question for you advanced users: I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. I'd appreciate any help. Thanks in advance. First question - Why do you think you need to materialize the view? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex (AT) attglobal (DOT) net ================== |
#4
| |||
| |||
|
|
"Jerry Stuckle"<jstucklex (AT) attglobal (DOT) net> escribió en el mensaje news:j95uoe$a4v$1 (AT) dont-email (DOT) me... On 11/6/2011 7:05 AM, Centrino wrote: Hi , I am new to MYSQL so here is a trivial question for you advanced users: I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. I'd appreciate any help. Thanks in advance. First question - Why do you think you need to materialize the view? Because the view is an extremely complex query that takes about one hour to be solved. Several processes and users use that view, and so, each time the view is queryed in order to obtain data in different formats one hour is lost. And so, materializing the view in one only query per day should speed up the total computing time since the main table is only updated once per day. top posting fixed |
#5
| |||
| |||
|
|
On 11/6/2011 12:24 PM, Centrino wrote: "Jerry Stuckle"<jstucklex (AT) attglobal (DOT) net> escribió en el mensaje news:j95uoe$a4v$1 (AT) dont-email (DOT) me... On 11/6/2011 7:05 AM, Centrino wrote: Hi , I am new to MYSQL so here is a trivial question for you advanced users: I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. I'd appreciate any help. Thanks in advance. First question - Why do you think you need to materialize the view? Because the view is an extremely complex query that takes about one hour to be solved. Several processes and users use that view, and so, each time the view is queryed in order to obtain data in different formats one hour is lost. And so, materializing the view in one only query per day should speed up the total computing time since the main table is only updated once per day. top posting fixed Second question - why does it take so long? Even with millions of rows across multiple tables I've never had a query take that long. I think you would be better off optimizing things. However, since you are hell bent on such a stupid procedure, just create the table(s) as part of your update job. A trigger is not the right tool for this. P.S. Pleade don't top post.g -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex (AT) attglobal (DOT) net ================== |
#6
| |||
| |||
|
|
"Jerry Stuckle"<jstucklex (AT) attglobal (DOT) net> escribió en el mensaje news:j96hfk$3rd$1 (AT) dont-email (DOT) me... On 11/6/2011 12:24 PM, Centrino wrote: "Jerry Stuckle"<jstucklex (AT) attglobal (DOT) net> escribió en el mensaje news:j95uoe$a4v$1 (AT) dont-email (DOT) me... On 11/6/2011 7:05 AM, Centrino wrote: Hi , I am new to MYSQL so here is a trivial question for you advanced users: I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. I'd appreciate any help. Thanks in advance. First question - Why do you think you need to materialize the view? Because the view is an extremely complex query that takes about one hour to be solved. Several processes and users use that view, and so, each time the view is queryed in order to obtain data in different formats one hour is lost. And so, materializing the view in one only query per day should speed up the total computing time since the main table is only updated once per day. top posting fixed Second question - why does it take so long? Even with millions of rows across multiple tables I've never had a query take that long. I think you would be better off optimizing things. However, since you are hell bent on such a stupid procedure, just create the table(s) as part of your update job. A trigger is not the right tool for this. P.S. Pleade don't top post.g The view query, runs perfectly well, as spected in design, No performance problems nor indexes problems. Key efficiency is 100%. The unswer is simple: complexity by design. |
#7
| |||
| |||
|
|
On 11/6/2011 12:57 PM, Centrino wrote: "Jerry Stuckle"<jstucklex (AT) attglobal (DOT) net> escribió en el mensaje news:j96hfk$3rd$1 (AT) dont-email (DOT) me... On 11/6/2011 12:24 PM, Centrino wrote: "Jerry Stuckle"<jstucklex (AT) attglobal (DOT) net> escribió en el mensaje news:j95uoe$a4v$1 (AT) dont-email (DOT) me... On 11/6/2011 7:05 AM, Centrino wrote: Hi , I am new to MYSQL so here is a trivial question for you advanced users: I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. I'd appreciate any help. Thanks in advance. First question - Why do you think you need to materialize the view? Because the view is an extremely complex query that takes about one hour to be solved. Several processes and users use that view, and so, each time the view is queryed in order to obtain data in different formats one hour is lost. And so, materializing the view in one only query per day should speed up the total computing time since the main table is only updated once per day. top posting fixed Second question - why does it take so long? Even with millions of rows across multiple tables I've never had a query take that long. I think you would be better off optimizing things. However, since you are hell bent on such a stupid procedure, just create the table(s) as part of your update job. A trigger is not the right tool for this. P.S. Pleade don't top post.g The view query, runs perfectly well, as spected in design, No performance problems nor indexes problems. Key efficiency is 100%. The unswer is simple: complexity by design. top posting fixed again No, the answer is even simpler. You're simply unable to fix your performance problems. You read somewhere about materialized views and figure that's a way around your problem (never mind the other problems it will create). After all, it's much simpler than finding the real cause of the problem and solving it. But I would expect nothing more from anyone who insists on top posting despite a polite request to follow netiquette. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex (AT) attglobal (DOT) net ================== |
#8
| |||
| |||
|
|
So please, save your insults to someone asking for ideas. |

#9
| |||
| |||
|
|
But who the hell are you to figure out what are our team programing skills or efficency !! ?? We are new to Mysql that's all. And not preciselly new to Db2 programming. Remember that if IBM, the inventor of Structured Query Language;, yes, SQL and relational algebrae, puts in the hands of programmers the materialized views, investing time and money developing them like Oracle did too, it is becouse they are very useul in real life. So please, save your insults to someone asking for ideas. |
#10
| |||
| |||
|
|
I need to materialize a view each time the main table is filled with records wich happens once a day. I know that MYSQL is not able to materialize views. |
|
So, my idea is to: - Set up something like a trigger after the event of the main table (the one that de view depends on), is truncated and then refilled with new records. -This trigger should: - delete old materialized view, (delete a table) - and then create a new table (materialized view) with the view structure filling it up with records. |
![]() |
| Thread Tools | |
| Display Modes | |
| |