Re: Okay SQL Gurus, Help me out......
Posted in 1997
Edmund Nigel Gall wrote: } } Jeffrey M. Frabutt wrote: } > } > I've got a table (I didn't design it) that stores dates in an integer } > column. The } > date is stored as the number of seconds since January 1, 1970. I have } > prepared } > an SQL query to select the value and convert it to a datetime: } > } > select datetime('01-01-1970 00:00:00', year to second) } > + integer_column units seconds } > from table } > ...... } > } > The logic works fine (my syntax might be a little off in this example) but } > it is } > SSSLLLLOOOOOOOOOOWWWW. It takes about 10 minutes to select all of } > the rows. The table currently has 600 rows on a Sun sparc. I am just } > about the only user on the machine. If I don't do the datetime conversion, } > the select is instantaneous. } > } > Does anyone have any suggestions on how to speed this up? } > . Alternate SQL syntax? } > . A completely different approach? } > I was in the same situation as you (someone making a date as an integer in a table because there was no date-time data type when the app was written. I can dig up a simple C function and post it for you if that will help. Tim