Subject | performance on calculated fields - performance question |
---|---|
Author | |
Post date | 2015-04-29T20:40:35Z |
Hello! I have a customers table. I created some calculated fields in order to have the complete name of each customer in a single column. I attach the field definitions below. I don't know whether my calculated fields are "complex" or not to Firebird!
I'm testing with aprox 40.000 rows
select * from customers where company containing 'something'
Prepare time = 0ms
Execute time = 93ms
Avg fetch time = 23.25 ms
or...
select * from customers where name_company containing 'something'
Prepare time = 15ms
Execute time = 281ms
Avg fetch time = 56.20 ms
---
create table customers (
first_name varchar(50),
second_name varchar(50),
name computed by (
coalesce(first_name,'') || ' ' ||
coalesce(second_name,'')),
company varchar(50),
name_company computed by (
trim(name ||
iif((company <> '')and
(name <> company)and
(name <> ''),', ','') ||
iif((name<>company),company,''))),