Snowflake dimension: named query vs. database view
A test question features a Product table with a Product Size code; Product Size description is taken from ProductSize table. As far as I can tell, the question asks me to choose between (a) setting up a database view joining Product and ProductSize, and
(b) doing the join in a data-source-view named query. I don't see a clear winner. (My thinking is as follows. Yes, he view would speed up the processing, even if not materialized. On the other hand, with a small dataset, the performance gain would be
minor in absolute terms. Do I want to have an extra database object in the picture?) Yet the question's author does. Can anyone advise please?
Hi Demyan,
According to your description, you want to know which is better, using named query in datasource view or using database view, right?
Based on my research, there is no performance differences between using named query in datasource view and using database view because they both result in SQL query being sent to the source system. Here is a blog which discuss this issue.
Consistency: If you already have logic in database views, I would continue to use them. As long as you know that you go to one spot to view/change the logic. Putting the logic in 2 different spots could lead to confusion.
Security Permissions: often you may not have permission to alter the source databases, in this case you have no choice but to setup named queries in the dsv.
Reference
http://geekswithblogs.net/darrengosbell/archive/2006/09/05/90278.aspx
http://bennyaustin.wordpress.com/2013/07/16/dbview/
Regards,
Charlie Liao
TechNet Community Support
Similar Messages
-
How to create olap cube using Named Query Table in Data source View
I Create on OLAP Cube using Existing Tables Its Working Fine But When i Use Named Query Table with RelationShip To other Named query Table It Not Working .So give me some deep Clarification On Olap Cube for Better Understanding
ThanksHi Pawan,
What do you mean "It Not Working"? As Kamath said, please post the detail error message, so that we can make further analysis.
In the Data Source View of a CUBE, we can define a named query. In a named query, you can specify an SQL expression to select rows and columns returned from one or more tables in one or more data sources. A named query is like any other table in a data source
view (DSV) with rows and relationships, except that the named query is based on an expression.
Reference:Define Named Queries in a Data Source View (Analysis Services)
Regards,
Charlie Liao
TechNet Community Support -
Hi,
Can we create a dimension on a database view instead of a table?
Thanks.For the purposes of ETL within OWB you can use a view as the basis of a dimension, you cannot generate dimension DDL for a dimension based on a view you will get the following error when trying to deploy;
ORA-01702: a view is not appropriate here
CWM2 does support such a dimension.
Cheers
David -
Query Rewrite with regular database Views
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. However, query rewrite doesn't work no matter how I define the MV and View. Here's an example:
I've Sales tables with columns: PDate, CustCode, Amount
and Customer table with columns: CustCode, CustDesc
I create a view SALES_V with columns: PDate, CustCode, CustDesc, Amount by joining Sales table with Customer table as follows:
create or replace view SALES_V as
select PDate, c.CustCode, c.CustDesc, Amount
from Sales s
join Customer c on (s.CustCode=c.CustCode);
For the sake of speed, I create a materialized view SALES_TOT_MV with columns: PDate, Amount with the following SQL:
create materialized view SALES_TOT_MV
enable query rewrite
as select PDate, sum(Amount) Amount from Sales
group by PDate;
When I run the following query, I expect it to be rewritten to make use of SALES_TOT_MV:
select PDate, sum(Amount) from SALES_V
group by PDate;
However, explain plan always tell me it's using SALES table, not the SALES_TOT_MV.
Can somebody tell me it's a limitation of Oracle optimizer or I'm just missing something for this?
Thanks in advance!!
- Andrew
Edited by: blackhole001 on Jan 28, 2010 12:34 PMblackhole001 wrote:
Hi all,
I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. This sounds like a pretty horrible idea. I say this because you will eventually end up with programmers that know nothing about your data model and how to properly interact with it.
Additionally, what you will get is a developer that takes one of your views and see's that of the 20 columns in it, it has 4 that he needs. If all those 4 columns comes from a simple 2 table join, but the view has 8 tables, you're wasting a tonne of resources by using the view (and heaven forbid they have to join that view to another view to get 4 of the 20 columns from that other view as well).
Ideally you'd write stored routines that satisfy exactly what is required (if you are the database resource and these other programmers are java, .net, etc... based) and the front end developers would call those routines customized for an exact purpose.
Creating views is not bad, but it's by no means a proper solution to having developers not learn or understand SQL and/or the data model. -
Select query on two Database views
Hi all,
Can i fetch the data by writing a select query on two DATABASE VIEWS
Because i am able to fetch data by writing a selct query on ONE DATABASE VIEW and ON TRANSPARANT TABLE
but i am not able to fetch data by writing a query on TWO DATABASE VIEWS
Query which i am able to fetch data is
select * from CSKS where OBJNR = COVJ-OBJNR
Query which i am NOT able to fetch data is
Select * from COAS where OBJNR = COVJ-OBJNR
Here
COVJ is a DATABASE VIEW
CSKS is a Transparant Table
COAS is a DATABASE VIEW
Thanks in advance
Regards
AjayHi
I tried with code and I am able to fetch data from view COAS
DATA:it_coas TYPE STANDARD TABLE OF coas.
SELECT * FROM coas INTO TABLE it_coas.
IF sy-subrc IS INITIAL.
WRITE:/ 'Sucess'.
ENDIF.
I think in your case COAS view does not have a value for COVJ-OBJNR.
Regards
Srilaxmi -
SQLParseException occurred while composing Offline Database View definition
While importing view definitions from CASE120 to offline database for some views I am getting following error.
ERROR: An SQLParseException occurred while composing Offline Database View definitions: Error(s) parsing SQL:
Unexpected token near *!* in the following:
, MSI.LO T_CONTROL_CODE *!*LOT_CONTROL_CODE
Unexpected token near *!* in the following:
, DECODE*!*(MSI.REVISION_QTY_CONTROL_CODE,1,'N',2,'Y','N') ITEM_REVISION_CONTROL_FLAG
Observation:
Some views with less total length of query definitions got imported, but big views were erroring out above said exception. Is there any restriction on the length of view? i.e. no of characters in the view definition? Is there any work around for this issue?
Thanks in Advance,
Salil GumasteHi Velázquez
Have you tried to modify your application and select "Process Application", this will rebuild your OLAP cube.
From past experience,and as per Santosh post, the errors appear your dimensions have not been processed.
You can try to do the following:
Process all of the dimensions
Modify the applications in your appset with selection the available options ( Rebuild SQL Index and Process Application )
Perform a full optimize of the application
Backup the Appset
Restore the Appset
This should hopefully resolve your errors
Hope this helps
Kind Regards
Daniel -
Select query in materialized view with two dblinks
Hi All,
We have oracle 10g On windows.
We are trying to create materialized view. Scenario is we have base table on other database and we are creating mview on different database.
Basa database have two schema's and i am selecting records from that two schema's using two private db links.
But when i am tryin gto create mview its not getting created. After 15 hrs. its still showing creation command and not finished.
Query is :-
Is it good practice to have two db links in select query of materialized view.Billy Verreynne wrote:
Chanchal Wankhade wrote:
Is it good practice to have two db links in select query of materialized view.Same db link being used twice, or two different db links?
If the former, you ideally want the local Oracle db to send the join to the remote database, and for the remote database to drive the join between those 2 tables. There is a hint (<i>driving_site</i>) that can be used - or the join query can be defined on the remote database as a view, and the local materialised view can then use that remote view.
If you have 2 different db links and joining across these - usually a bad idea to perform distributed database joins. There are lots of limitations as to how the tables can be joined. Worse case, full table scans of both remote tables, pulling all the rows from the 2 remote database tables to the local database, and joining these on the local database.
I have seen some severe performance issues in the past as a result of distributed joins. I'll rather use 2 materialised views for pulling both distributed tables's data locally, and then do the join on local data (using indexes, partition pruning, etc)Hi Billy,
My scenario is i have two database database A and database B. Database A is having two schema's SCOTT AND HR. SCOTT schema have select privileges on HR schema.
DB LINK is between Database B to Database A. name is db.link.B.A.oracle.com.
What if i priovide while creating materialized view, the schema name before the table name in database B for this particuler table so it will pick up the table from that schema using same DB LINK(db.link.B.A.oracle.com.) that i am using to fetch records from SCOTT schema.
Above schnario is like two base schema's and one db link using two schema. -
Multiple Rows Update / Refresh Toplink Query when database trigger involved
Hi everybody!
I have two easy troubles for you; the platform is the same as the SRDemo Toplink version.
1. Multiple Rows Update: I want to update with mergeEntity method, multiple rows for an isolated table; that method receives a parameter that I try to bind with the iterator "dataProvider" but it only merges the first row, not all, any other combination returns an error.
What I want to do is to have a form (like tabular forms in Apex) that lets me update multiple rows in a single page. ¿May anyone tell me how to do it?
2. Refresh Toplink Named Query: I have a list on a page with two columns. From another page, a button does an action that fires a database trigger that updates one of the columns on the list´s page. When I go back to the list, it is not updated; however, the CacheResults´s property is set to false on the iterator.
Thanks in advance,
Alejandro TI didn't use it (yet), but - you might take a look. You'll find a [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html]Timer plug-in on this page. It is a dynamic action which allows you to periodically fire other dynamic actions in the browser. For example use the timer to refresh a region every five minutes. You can perform any dynamic action you want using this infrastructure.So I was thinking: you might use it to run a dynamic action which would check whether something changed in that table (I suppose you'll know the way) (for example, a database trigger might set a flag in some table, timestamp or similar), and - if you find that something really changed - refresh the page.
As I said, I never used it so that's pure theory. Someone else might know better, though. -
Database View do not refresh in ADF application
Greetings,
im facing a weird problem in my application (JDeveloper 11.1.2.4.0 - ADF). All this time i was working directly with tables (VO), but now i also started using database views.
Everything works fine, when i add a new row in a table that my Database Views is associated with, it refresh properly.
BUT if i delete rows manually from my database, the View do not refresh in my application, not by refreshing the page,
redeploying application, even executing the view object query inside the view object. The only way for the DB View to be
refresh inside the JDeveloper and on deployment time is by restart JDeveloper. I try adding an action on my OV to re-execute them when
i do something specifically, hopefully the will reset the cache and retrieve the DB view again, but with no luck..
Correction: now it doesnt even refresh on restart jdeveloper.
Just for the clarification, im talking about Database Views, and not just Object Views. I create a Object View inside the application to retrieve the data
from the Database View results.
Can you help me on this please?Yes the queries in SQLDeveloper was showing me correct results.
But i feel disappointed.. When i went to close SQLDeveloper to try something, it pop me a message to commit/rollback changes.
After i commit them, my app show correct results too. -
How to query a database file on my hard drive?
Hi,
I have a filer called "server.dbs" on my hard drive. It is a database file. I use a simple program that allows you to view databases, and it loads up and I can traverse the database and see all the entries as any standard database.
So I figured that Java's ability to handle SQL would allow me to make a standard SQL statement querying the database, and be able to get the results. The software stores servers in SID fields, and the value is the port the server runs on. I want to make a simple query to select a server by SID, and print the port in which that server is running on.
So is there any way to, via my java application, load a database from a file (rather than a url) which has no authentication required, and simply make my queries directly to that file? If so, how?
Thanks!
-JoshNormal database access is via JDBC.
http://java.sun.com/docs/books/tutorial/jdbc/index.html
To use that JDBC driver is needed to access the database. Databases in wide usage all have one. It isn't clear from your posting that you have a common database though. -
Set operator NE in Database View creation in join condition
Hi Experts,
I have a requirement to set NE(not equal) operator in join condition of Database View creation. Could you please help me how to set in operator.
Join condition :
Ex : BSAK-AUGBL NE BSAK-BELNR.
You know that by default operator is '='. i want to set NE in place of '='.
Thanks,Hi Chinna,
Check whether if there is any possibility or not to include more key fields like bukrs, lifnr, gjahr etc in the where condition, so that you query may result faster. Then, there won't be any necessary to create the view.
Hope this helps.
Please reward if useful.
Thanks,
Srinivasa -
How to call database view in report
Hi i have a small problem in report
the problem is like this i had created a database view in which i got all the values displayed but can any one of you tell me how to declare this database view in report with example
i had created a database view named as znew1
and the fields are
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
LIFNR1 LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
EKBE LIKE EKBE-EBELN,
VGABE LIKE EKBE-VGABE,
MATNR LIKE EKPO-MATNR,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
MENGE LIKE EKPO-MENGE,
MWSKZ LIKE EKPO-MWSKZ,
TXZ01 LIKE EKPO-TXZ01,
KOSTL LIKE EKKN-KOSTL,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
EBELN1 LIKE EKKN-EBELN,Hi Mr. Rich
This is the program code and i want this output int he alv grid format
TABLES:EKKO,EKBE,EKPO.
DATA:BEGIN OF RTAB_ALV OCCURS 30,
LIFNR LIKE EKKO-LIFNR,
EBELN LIKE EKKO-EBELN,
LIFNR1 LIKE LFA1-LIFNR,
NAME1 LIKE LFA1-NAME1,
EKBE LIKE EKBE-EBELN,
VGABE LIKE EKBE-VGABE,
MATNR LIKE EKPO-MATNR,
WERKS LIKE EKPO-WERKS,
NETWR LIKE EKPO-NETWR,
MENGE LIKE EKPO-MENGE,
MWSKZ LIKE EKPO-MWSKZ,
TXZ01 LIKE EKPO-TXZ01,
KOSTL LIKE EKKN-KOSTL,
PS_PSP_PNR LIKE EKKN-PS_PSP_PNR,
EBELN1 LIKE EKKN-EBELN,
END OF RTAB_ALV.
DATA:IZNEW1 TYPE TABLE OF ZNEW1 WITH HEADER LINE.
select * into table IZNEW1 FROM ZNEW1 UP TO 10000 ROWS. -
Using database views in ADF mobile client application
Hi,
I am using Jdeveloper 11.1.1.4 and WLS 10.3.4.
I have developed a POC in ADF mobile client application both with and without synchronization. However, both work with entity objects based on tables.
I need to use database views instead of tables. When I try to include entity object (based on views) in the view object, it shows an error saying "Only the entity objects based on tables can be selected"
Please guide me if there is a work around for this.
Also, please let me know if there is way to develop an ADF mobile client application skipping the use of entity objects at all and using view objects directly to specify the database query and fetch data from the database.
Thanks in advance.
Ansh
Edited by: ansh on Mar 28, 2011 5:40 AMHi, Ansh:
Currently, out of box, ADF Mobile Client does not support synchronization against Database Views. This is because Mobile Server imposes some schema restrictions to ensure synchronization with multi-table views would work correctly. This schema restriction requires, for example, the view must have a primary parent table with key defined, and also all base table must be included in the data publication. These dependencies requires manual resolution and advanced planning, and is managed outside of the ADF Mobile Client/JDeveloper project.
To continue development, you would need to create server Entity Objects directly against the base tables. You can then create the mobile ADF Business Component (EOs, VOs, etc). You can then create View Objects in your ADF Mobile Client application based on the database views, in order to retrieve the data you need exactly. In other words, instead of basing EO on the database view, create View Objects in the mobile applicaiton to mimic what you had in the View Object.
Is there any other reason why you would need to access data via database views, instead of directly against base tables?
Thanks,
Joe Huang -
Short Dump while fetching values from a Database view
Hi ALL,
Here is the code that is giving short dump
SELECT * FROM ZVMATLMOVE INTO TABLE I_MATLMOVE
WHERE BUDAT >= V_LASTRUN_DATE
AND WERKS IN S_WERKS
AND LIFNR IN S_LIFNR
AND EBELN IN S_EBELN
AND MATNR IN S_MATNR
AND BWART IN S_BWART
(Please don't say that I am using * in the select query,
I knew that it is not a good way of fetching values)
Declaration of the internal table is:
DATA I_MATLMOVE LIKE ZVMATLMOVE OCCURS 0 WITH HEADER LINE.
The variable V_LASTRUN_DATE is:
DATA V_LASTRUN_DATE LIKE SY-DATUM.
We will be getting the lastrundate value from another table. And it is passing correct value (ex. 20060731)
ZVMATLMOVE is a database view created for MKPF and MSEG table. And I checked both table were consistent.
Dump Analysis:
Runtime errors DBIF_RSQL_SQL_ERROR
Exception CX_SY_OPEN_SQL_DB
Every thing is fine. But I don't know how it is going to dump. Any suggestions?Hi !
It seams that your table is not correct / fully activated.
To check it out you should try the following:
- Go to the SE11
- Give it your table name and go to "Display"
- Check if the table is "active"
- Choose "Utilities->Database Object->Check" and see
if there are any errors
- go back and choose "Utilities->Runtime Object->Check"
and see if there are any errors
If there are any errors - try to activate the table again. You may need the "Utilities->Database Utiliy" for that.
After there are no more errors by checking all these your program should work.
Regards
Rainer
Some points would be nice if thate helped a bit. -
Im trying to read data from V_TVKBZ_ASSIGN view using the query *select * from V_TVKBZ_ASSIGN into zV_TVKBZ_ASSIGN where VKORG = gs_bapikna102_gwa-SALESORG VTWEG = gs_bapikna102_gwa-DISTR_CHAN SPART = gs_bapikna102_gwa-DIVISION.*
endselect.
However i get the error message " V_TVKBZ_ASSIGN" is not defined in the ABAP Dictionary as a table,projection view, or database view.
How do i go ahead with this query?Since V_TVKBZ_ASSIGN is a maintenance view you can't write select query for that. For select query it should be a database table or database view or projection view . Better you can write the select query for underlying tables of that view like
TVKBZ
TVBUR
TVKO
TVKOT
TVKBT
TASSIGN_SD_VKORG
TVKOS
TVKOV
TVTW
TSPA
TVTWT
TSPAT
Maybe you are looking for
-
ITunes 10.5.3 for Windows crashes when loading Library
I am running iTunes 10.5.3 for Windows 7 and somehow my library has been corrupted and will not load..i tried using a previous library loading in safe mode, and it appears to work until it gets the the Genius update, when it crashes..has anyone had a
-
What are the configuration tht pi administration have to perform
hi friends i am new to pi can any one help me what are the configuration tht pi administration have to perform and post installation to be done after installing pi in stand alone box? plz help thnks ravi
-
IPhone 4S Case That Won't Interrupt Camera
As some of you may know, the camera on the iPhone 4S doesn't function properly if the opening for the camera isn't large enough. I want to get a case that doesn't interrupt with the camera meaning it has a pretty large opening for it. Do you guys kno
-
Hi all, We seem to be having a strange issue with Offline Files and resolving conflicts. It seems that files that have had no change seem to be flagged as changed and show in the Conflicts list awaiting user input. However, when the user tries to res
-
I want to replace my itouch 4? How much does Apple charge? $99 or $199?