Re: Find between a list of values

From: J.O. Aho <user_at_example.net>
Date: Sun, 1 Apr 2018 23:39:24 +0200
Message-ID: <fid1scFnpppU1_at_mid.individual.net>


On 04/01/18 19:01, gandalf.corvotempesta_at_gmail.com wrote:
> Il giorno sabato 31 marzo 2018 14:40:13 UTC+2, Jerry Stuckle ha scritto:

>> The first thing you need to do is normalize your database.  One value 
>> per row/column.  If I read this properly, you should have a second table 
>> linked to the first with three columns - id of the first table row, 
>> start and stop.  You may add a fourth column for a unique id of the row.

>
> Sure, and where i can, i've started to normalize the database.
> But that's not easy but is what I'm already using with already normalized tables.
>
>
> I've asked here thinking about a workaround, to speed up lookups on existing tables planned for a future refactor.

As I wrote, there ain't anything you can do to speed it up, you need to select out every row and then parse the data so that you get the start and end time in a numeric value and then check if the value you are looking for is between the start and end time. The time will increase for each new value you insert into the database and the more ranges one value have the more it will slow the whole down.

You need to refactor the table at once, you will just cause more issues for yourself the longer you wait.

-- 

 //Aho
Received on Sun Apr 01 2018 - 23:39:24 CEST

Original text of this message