last day (15 days later) » 

05:05
1
A: How can I query just the month and day of a DATE column?

Jonathan LefflerIf it will be frequently used, consider a 'functional index'. Searching on that term at the Informix 11.70 InfoCentre produces a number of relevant hits. You can use: WHERE MONTH(date_col) = 12 AND DAY(date_col) = 25; You can also play games such as: WHERE MONTH(date_col) * 100 + DAY(date_c...

It would be preferrable to use an index, as there's ~13 million rows. I'm wondering what is the cost of querying on MONTH(birthdate) and DAY(birthdate), versus adding 3 separate integer columns and populating them with the month, day and year, while retaining the original date column. Birthdate is a value that seldom changes unless a data entry error was made.
It's going to depend on the queries you really run. If you're looking to ensure that the punter is at least 21 years old, you'll need the date in full. If you're looking at birthdays, then the day and month components make sense. I'm not sure how often (if ever) you'd want year and month or (even less plausibly) year and day of month. So I doubt that a year column would be worthwhile; if you do a lot of birthday searches, then month and day might make sense, but I'd still do measurements, and I'd look at a functional index before storing separately.
With 13 million rows, you're going to have a lot of repetition in an index on month/day (35,000 entries per day of the year). On its own, it is moderately selective (0.3% selectivity is not bad). If combined with other conditions, then it's likely they'll provide alternative indexes. It really depends on the queries you'll execute.
Well, the query is to determine one week before, which of the ~13 million customers have a birthday comming up so we can send them a $100 gift! :-) How did you arrive at 35,000 birthdays per year if there are only 365 or 366 birthdays per year? The birthday distribution for ~13 million customers doesn't distribute equally.
I arrived at 35,000 entries per day of the year from 13,000,000 / 365.
Interesting, now we can sample the ~13M customers to see which is the most frequent birthday. BTW, I noticed the onconfig.instance file in FC6 now includes DSS parameters. How can I tune onconfif for maximum query performance? I'm the only one executing DSS queries, have 4GB's of RAM (need 1GB for Windows), 1TB disk, dual processors.
05:11
Look up the performance tuning guidelines. There are various PDQ* parameters that can be set. PDQPRIORITY is one. Another to consider is NONPDQ_MAX_SORT_MEMORY (in concept, even if not in detailed spelling).
DS_NONPDQ_QUERY_MEM
The default is a paltry 128 KiB or thereabouts; you can afford to set it higher.
The maximum is constrained by other PDQ parameters, so you need to set the ensemble appropriately.
You should look at how many CPU VPs you're allowed to run, and run that many of them.
I had a new customer that when I added his birthdate in the birthdate column, my app said he was not 18 years old and by law, is not allowed to pawn his property, yet he really turned 18 on that day. My app does (TODAY - dob) / 365.25 = age DECIMAL(3.2). The result of that was 17.93, however he was born on the same month and day, 18 years ago! How to solve this?
Depending on what else is running on the machine, you might want to use as much as half the memory as Informix shared memory (if your data set is a significant proportion of that size, or larger).
Use 365.2422 instead of 365.25 as the divisor?
Or TODAY - 18 UNITS YEAR
DoB <= TODAY - 18 UNITS YEAR
With the more recent versions of Informix (released since March 2012), the date calculation will even work on a leap day (when 18 years before the leap day is categorically not a leap day).
As to onconfig, the default values were set for an OLTP instance, however the DSS params were set to 100%, but buffer pools looked low. I reduced MAXQUERIES to 3.
You probably only need one buffer pool (4K pages on Windows). Make it as big as you can. Keep an eye on the overall memory use, and on 'onstat -p' cache rates (read cache especially).
As to the pawnshop app, its still running on SE 4.10 so I'm SOL on those new features :(
05:18
OK; the rules change with SE 4.10.
But Informix means 11.x IDS unless you qualify the question with something else.
Indeed, 11.50 or (normally) 11.70.
Does IBM-Informix have any plans to market a "Lite" version of isql, i4gl and dynamic server for Windows?
ISQL and I4GL - no. There are various editions (Express, Innovator-C, Growth, and I forget the others; there are a total of 8 editions, including Growth Warehouse, Ultimate, and Ultimate Warehouse).
I'm long overdue to migrate the 22+ yr ole pawnshop app and need a Single-user Win-based DSS app with a 128GB dbsa.. In 4.10, I'm still using my handy date fact lookup table (01011900:12312050) for many date calcs.
A date dimension table in 'Data Warehousing' terminology makes a lot of sense for many purposes.
I went off and ran:

select today - date('1994-12-13'), (today - date('1994-12-13'))/365.25 from dual;
6576 18.0041067761807
Oh, but my server is running in UTC, so it is already 14th December...
If SE 4.10 had a blind spot about 2000-02-29, then you might get TODAY - DATE('1994-12-14') as 6574, which when divided would be 17.9986.
I thought it was OK, but that's the best explanation I can come up with...
SQL[1719]: select date('2012-12-13') - 18 units year from dual;
1994-12-13
SQL[1720]: select date('2012-02-29') - 18 units year from dual;
1994-02-28
I have my DBDATE set to Y4MD- so that date strings look like DATETIME YEAR TO DAY strings.
05:56
Interesting results!.. I'm glad 11.70.xC5(6) resolved many issues with date arithmetic. The U.S. Credit Act of 2009 mandated several changes to how intervals are calculated for billing cycles and interest payments.
In 4.10, maybe I could say pseudo If age >= 17.97 and age <=17.999 then let age = 18?.. close enough?
There's only an issue with DATE - n UNITS YEAR on a leap day, even in 4.10.
1 day is approximately 0.003 years? So, for the time being (until 2018-03-01, in fact), you could compensate if there's a problem with 4.10 not recognizing 2000-02-29.
One of the first tests I'd do is SELECT DATE('2012-12-13') - DATE('1994-12-13') FROM systables WHERE tabid = 1;
If that gives the correct answer of 6575, then 4.10 does not have a Y2K problem. If it gives an answer of 6574, then (I think) it has a Y2K problem.
You could always decide that 18 years is 18 * 365 days + 4 * 1 = 6574 days, and ... hmm, you have to allow for 5 leap years and hence 6575 days, ... grrr ... it's getting late ... subtracting a number of days always works.
You could check for 18th birthday kids specially. For those under age, the calculation of DoB < TODAY - 6574 says "you're too young". For those over age, the calculation DoB < TODAY - 6575 says "you're old enough". For those with a birthday in between, you can dissect the MONTH(DoB) * 100 + DAY(DoB) <= MONTH(TODAY) * 100 + DAY(TODAY)?
Does that make sense?
07:02
Yes, makes a lot of sense, I tested your equation and it works. However, 2012-12-13 minus 1994-12-13 gave me 6575, so no Y2K problem in that date arithmetic, but if you use YMD2- then it thinks 12-12-13 is 1912-12-13. There's no DBCENTURY for 4.10, so I use YMD4- for entering, displaying and calculating all dates.
Why until 2018-03-01?

last day (15 days later) »