![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Gang, I've got a situation where tables are physically partitioned in a database into years: y05_sales_order y06_sales_order y07_sales_order y08_sales_order y09_sales_order Well, you get the idea. This design cannot be easily changed as there is a ton of ABF code that needs to work against it for years to come. It doesn't mesh well with today's O/R mapping tools. But I found a nice way to do it using private views. In our application, the user is connected to the database using her actual credentials, so they have the luxury of creating private views like create view my_sales_order as select * from y06_sales_order When the user of the app selects a different year to work with, we drop all the private views and create new ones. My question is, does this present a concurrency issue? Will all this creating and dropping views cause contention on the system tables? I don't pretend to understand the complex locking that is done during DDL, but I'm sure somebody out there does. Whaddaya think? Mikey _______________________________________________ Info-Ingres mailing list Info-Ingres (AT) kettleriverconsulting (DOT) com http://ext-cando.kettleriverconsulti...fo/info-ingres |
#3
| |||
| |||
|
|
Gang, I've got a situation where tables are physically partitioned in a database into years: y05_sales_order y06_sales_order y07_sales_order y08_sales_order y09_sales_order Well, you get the idea. This design cannot be easily changed as there is a ton of ABF code that needs to work against it for years to come. It doesn't mesh well with today's O/R mapping tools. But I found a nice way to do it using private views. In our application, the user is connected to the database using her actual credentials, so they have the luxury of creating private views like create view my_sales_order as select * from y06_sales_order When the user of the app selects a different year to work with, we drop all the private views and create new ones. My question is, does this present a concurrency issue? Will all this creating and dropping views cause contention on the system tables? I don't pretend to understand the complex locking that is done during DDL, but I'm sure somebody out there does. Whaddaya think? |
#4
| |||
| |||
|
|
And here's another idea. *How about creating a single physical table with rule-based partitioning, then create views on the partitioned table to give the old apps the original schema of yearly tables? This would avoid any contention over the catalogues. |
#5
| |||
| |||
|
|
[snip] create view my_sales_order as select * from y06_sales_order When the user of the app selects a different year to work with, we drop all the private views and create new ones. My question is, does this present a concurrency issue? Will all this creating and dropping views cause contention on the system tables? |
#6
| |||
| |||
|
|
A single physical table partitioned up with views on partitions is a very clever solution that can also offer performance benefits. The only downside of Ingres' current implementation of table partitioning is that it is somewhat limited at the moment. Ingres needs to have the ability to ONLINE MODIFY, TRUNCATE, MERGE, DROP, ADD, BULK COPY and INDEX partitions. |
#7
| |||
| |||
|
|
[snip] And here's another idea. How about creating a single physical table with rule-based partitioning, then create views on the partitioned table to give the old apps the original schema of yearly tables? This would avoid any contention over the catalogues. -- Roy |
#8
| |||
| |||
|
|
On Nov 18, 2009, at 12:12 AM, Mike Leo wrote: [snip] create view my_sales_order as select * from y06_sales_order When the user of the app selects a different year to work with, we drop all the private views and create new ones. My question is, does this present a concurrency issue? Will all this creating and dropping views cause contention on the system tables? A view create in Ingres is relatively heavy-weight, because of all of the catalogs that must be touched. Very roughly, Ingres will: - take an X control lock on the base table(s) (not good for concurrency) - write view info into iiqrytext, iitree (both btree, page or row locks) - write dependency info into iidbdepends and possibly iipriv (btree, page/row locks) - write the view "table" info into iirelation / iiattribute (physical page locks, page written and lock dropped at unfix) You'll get [leaf] page locks on the btree catalogs unless you have session or system isolation level set to repeatable_read or lower. Obviously you'll need lock level set to row as well, for row-locking. You can't force row locking in the core catalogs, but those page locks aren't persistent (unlike the other locks). The nastiest one is probably the X control lock on the base tables. That has the effect of blocking selects on those tables, and I think it even blocks in readlock=nolock mode (i haven't tried it recently). I'm not real sure why Ingres feels the need to X-control-lock the base tables; one would think that an S control lock would do. But, that's the way we've always done it. I might put that one on my to-do-someday list. |
#9
| |||
| |||
|
|
On Nov 18, 2009, at 6:57 AM, Karl Schendel wrote: On Nov 18, 2009, at 12:12 AM, Mike Leo wrote: [snip] create view my_sales_order as select * from y06_sales_order When the user of the app selects a different year to work with, we drop all the private views and create new ones. My question is, does this present a concurrency issue? Will all this creating and dropping views cause contention on the system tables? A view create in Ingres is relatively heavy-weight, because of all of the catalogs that must be touched. Very roughly, Ingres will: - take an X control lock on the base table(s) (not good for concurrency) - write view info into iiqrytext, iitree (both btree, page or row locks) - write dependency info into iidbdepends and possibly iipriv (btree, page/row locks) - write the view "table" info into iirelation / iiattribute (physical page locks, page written and lock dropped at unfix) You'll get [leaf] page locks on the btree catalogs unless you have session or system isolation level set to repeatable_read or lower. Obviously you'll need lock level set to row as well, for row-locking. You can't force row locking in the core catalogs, but those page locks aren't persistent (unlike the other locks). The nastiest one is probably the X control lock on the base tables. That has the effect of blocking selects on those tables, and I think it even blocks in readlock=nolock mode (i haven't tried it recently). I'm not real sure why Ingres feels the need to X-control-lock the base tables; one would think that an S control lock would do. But, that's the way we've always done it. I might put that one on my to-do-someday list. Karl, Synonyms are interesting. I did some testing, monitoring locks with IPM, and I noticed something. If I create a view on each of the year-based tables (let's say in the DBA's schema), and then I create local synonyms for each user on the desired view, I only see locks being created on the view, and NOT on the ultimate base table. And I noticed that creating synonyms is about 3 times "lighter", at least lock-wise. What do you think of that? Too much of a hack? Seriously. What do you think? Thanks, Mikey _______________________________________________ Info-Ingres mailing list Info-Ingres (AT) kettleriverconsulting (DOT) com http://ext-cando.kettleriverconsulti...fo/info-ingres |
#10
| |||
| |||
|
|
Synonyms are interesting. I did some testing, monitoring locks with IPM, and I noticed something. If I create a view on each of the year-based tables (let's say in the DBA's schema), and then I create local synonyms for each user on the desired view, I only see locks being created on the view, and NOT on the ultimate base table. And I noticed that creating synonyms is about 3 times "lighter", at least lock-wise. What do you think of that? Too much of a hack? |
![]() |
| Thread Tools | |
| Display Modes | |
| |