"A computed column is a column whose value is calculated before storing. "
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/tS1mfNz04fEJ.
> To post to this group, send email to h2-da...@googlegroups.com.
> To unsubscribe from this group, send email to
> h2-database...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/h2-database?hl=en.
http://h2database.com/html/features.html#computed_columns"A computed column is a column whose value is calculated before storing. "
Hi,
I think it's rather uncommon to use a query for a computed column. What is your use case? What does the query look like exactly?
I don't know what the problem could be. The most obvious things is to ensure the query is fast, but I guess you have already verified that, right? Then, I would probably use the built-in profiler or just "jps -l" and "jstack -l <pid>" to get a few full thread dumps. That way you can find out what exactly is slow.
Regards,
Thomas
--
Thats why your inserts are slow.
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/h2-database/-/Vein3YJLMqcJ.
Nope, it's very fast in terms of what I wrote: �If I then add a computed column to that table, for example a computed column that selects on a related table (using PK), the 'alter table' takes [merely] a few seconds.��This is based on my understanding that the values are calculated upon ADD COLUMN.�If you�re saying that the values are instead calculated on the fly (not during ADD COLUMN) then it�s different than the documentation. The performance problem only occurs with INSERT and MERGE. I�ll work on the profiling and bug report when I get the chance.
On Friday, April 13, 2012 1:54:03 PM UTC+8, Noel Grandin wrote:Read the bit about "the value is calculated before storing"Thats why your inserts are slow.
--
We'd need a new feature that basically said "don't store/cache this
computed column"
If you want to work on such a thing, the place to start looking in the
code is probably by working backwards from this method:
org.h2.table.Column#computeValue(Session, Row)
You're also welcome to try running a profiler, and seeing if you can
spot something. It's quite possible your use case is triggering a
performance issue we haven't seen before.
The most obvious things is to ensure the query is fast, but I guess you have already verified that, right? Then, I would probably use the built-in profiler or just "jps -l" and "jstack -l <pid>" to get a few full thread dumps. That way you can find out what exactly is slow.