Re: When to store data that could be derived

2019-03-26 Thread Frank
On 2019-03-25 5:44 PM, Frank wrote: On reflection, I have not been consistent with my use of indexes, and I think that will affect the query plan. There are at least two issues - 1. The first table defined in the VIEW is ccc.ar_tran_inv. It has the following index -     "arinv_cust_date

Re: When to store data that could be derived

2019-03-25 Thread Frank
On 2019-03-25 5:11 PM, Frank wrote: On 2019-03-25 4:06 PM, Ron wrote: On 3/25/19 8:15 AM, Frank wrote: It would be interesting to see what the query planner tries to do with this: WHERE CASE WHEN a.tran_type = 'ar_rec' THEN y.posted WHEN a.tran_type = 'cb_rec' THEN

Re: When to store data that could be derived

2019-03-25 Thread Frank
On 2019-03-25 4:06 PM, Ron wrote: On 3/25/19 8:15 AM, Frank wrote: It would be interesting to see what the query planner tries to do with this: WHERE     CASE     WHEN a.tran_type = 'ar_rec' THEN y.posted     WHEN a.tran_type = 'cb_rec' THEN w.posted     END = '1' I have atta

Re: When to store data that could be derived

2019-03-25 Thread Ron
On 3/25/19 8:15 AM, Frank wrote: On 2019-03-24 2:41 PM, Peter J. Holzer wrote: On 2019-03-24 10:05:02 +0200, Frank wrote: Many thanks to Peter et al for their valuable insights. I have learned a lot. > So the important part here is not whether data is added, but whether > data is changed. Sur

Re: When to store data that could be derived

2019-03-25 Thread Frank
On 2019-03-24 2:41 PM, Peter J. Holzer wrote: On 2019-03-24 10:05:02 +0200, Frank wrote: Many thanks to Peter et al for their valuable insights. I have learned a lot. > So the important part here is not whether data is added, but whether > data is changed. Sure, new transactions are added al

Re: When to store data that could be derived

2019-03-24 Thread Chris Travers
Meant to send this to the list but hit the wrong button. On Sun, Mar 24, 2019 at 9:45 AM Ron wrote: > On 3/24/19 3:05 AM, Frank wrote: > > > > > > On 2019-03-24 9:25 AM, Ron wrote: > >> On 3/24/19 1:42 AM, Frank wrote: > >>> Hi all > >>> > >>> As I understand it, a general rule of thumb is that

Re: When to store data that could be derived

2019-03-24 Thread Peter J. Holzer
On 2019-03-24 10:05:02 +0200, Frank wrote: > > > On 2019-03-24 9:25 AM, Ron wrote: > > On 3/24/19 1:42 AM, Frank wrote: > > > As I understand it, a  general rule of thumb is that you should > > > never create a physical column if the data could be derived from > > > existing columns. The main re

Re: When to store data that could be derived

2019-03-24 Thread Ron
On 3/24/19 3:45 AM, Ron wrote: [snip] In every DBMS that I've used, the lside (left side) needs to be static (not "a" static) instead of variable (like a function). Thanks to Chris Travers for reminding me that the word is "immutable", not "static". -- Angular momentum makes the world go 'ro

Re: When to store data that could be derived

2019-03-24 Thread Frank
On 2019-03-24 11:11 AM, Tony Shelver wrote: Not the answer you are looking for, but... I'd suggest trying to create a non-trivial set of dummy data to test your assumptions before deciding on a route. It's saved my (professional) life a few times over the years when dealing with untested desi

Re: When to store data that could be derived

2019-03-24 Thread Tony Shelver
Not the answer you are looking for, but... I'd suggest trying to create a non-trivial set of dummy data to test your assumptions before deciding on a route. It's saved my (professional) life a few times over the years when dealing with untested designs and new (to us) technology. Some years ago w

Re: When to store data that could be derived

2019-03-24 Thread Chris Travers
On Sun, Mar 24, 2019 at 9:05 AM Frank wrote: > > > On 2019-03-24 9:25 AM, Ron wrote: > > On 3/24/19 1:42 AM, Frank wrote: > >> Hi all > >> > >> As I understand it, a general rule of thumb is that you should never > >> create a physical column if the data could be derived from existing > >> colum

Re: When to store data that could be derived

2019-03-24 Thread Ron
On 3/24/19 3:05 AM, Frank wrote: On 2019-03-24 9:25 AM, Ron wrote: On 3/24/19 1:42 AM, Frank wrote: Hi all As I understand it, a  general rule of thumb is that you should never create a physical column if the data could be derived from existing columns. A possible reason for breaking this

Re: When to store data that could be derived

2019-03-24 Thread Frank
On 2019-03-24 9:25 AM, Ron wrote: On 3/24/19 1:42 AM, Frank wrote: Hi all As I understand it, a  general rule of thumb is that you should never create a physical column if the data could be derived from existing columns. A possible reason for breaking this rule is for performance reasons.

Re: When to store data that could be derived

2019-03-24 Thread Ron
On 3/24/19 1:42 AM, Frank wrote: Hi all As I understand it, a  general rule of thumb is that you should never create a physical column if the data could be derived from existing columns. A possible reason for breaking this rule is for performance reasons. I have a situation where I am consid

When to store data that could be derived

2019-03-23 Thread Frank
Hi all As I understand it, a  general rule of thumb is that you should never create a physical column if the data could be derived from existing columns. A possible reason for breaking this rule is for performance reasons. I have a situation where I am considering breaking the rule, but I am