Questions tagged [view]

A virtual table that represents the data in one or more tables in an alternative way.

Filter by
Sorted by
Tagged with
0 votes
0 answers
26 views

Two views yielding the same results switch places performance-wise when called remotly

An SQL Server 2000 has a view "A" that produces around 700 rows of data in about 30 seconds. I was tasked with optimizing "A" and created a view "B" that produces the ...
user avatar
0 votes
3 answers
73 views

Using Boolean Fields in a View to Identify Linked Tables

I am using SQL Server 2019. I am using SQL Server Management Studio on the client side. Suppose I have the following data model: -- A record of the overall test of a widget CREATE TABLE [TestRecords] ...
user avatar
  • 157
0 votes
1 answer
38 views

How to optimized self-join view of 50 millions rows table

I've the following simplified table with ~50M rows. table sample ( id uuid not null primary key, measured_date timestamp with time zone not null, segment_id uuid not null, activity_id ...
user avatar
-3 votes
0 answers
26 views

how to create cross database view in postgresql

I have two databases DB_A, DB_B . In database DB_A there is table Tab_A, Tab_B, Tab_C. I want to create a view in DB_B using tables Tab_A, Tab_B, Tab_C in DB_B the which some selected columns are only ...
user avatar
0 votes
0 answers
25 views

Optimizing a view query that uses pivot aggregation - Oracle

I have a table with columns as - | ID | cat_1 | cat_2 | type | value | |----|-------|-------|------|-------| |1 | a |b | t1 | 4 | |2 | b |d | t2 | 5 | |3 | b |e ...
user avatar
1 vote
1 answer
84 views

Naming conventions for views and materialized views: "*_v", "v_*", "*_mv", "mv_*" or none? [closed]

My view stores quality metrics for various gizmos1 in the database. Today I designed it to be a view. In a few years, as we produce more gizmos, it may need to be changed to a materialized view. I was ...
user avatar
19 votes
6 answers
2k views

Is there a generic term for tables and views?

I am looking for a generic term, e.g. for a database abstraction, that includes all tabular data structures like database tables, views, tabular query results aso. As far as I understand, 'entity' is ...
user avatar
0 votes
0 answers
13 views

Query to Include All Records

I am trying to create an excel report and am running into an issue that I am most likely overthinking. What I am trying to do is create multiple pivot tables to show me my overall inventory and then a ...
user avatar
  • 126
0 votes
0 answers
68 views

SQL (postgres) - Recursive view for all parents of a child

Solved: Solution from crossposting: https://stackoverflow.com/a/71149082/8082262 I have two tables: community2collection(collection_id,community_id) and community2community(child_comm_id,...
user avatar
0 votes
1 answer
31 views

View to insert records into history table and then find changes with Except query

I want to insert records to a history table and show the changes from the previous day in a view. The script works, but when I try to create a view I get an error message that incorrect syntax near ...
user avatar
  • 5
0 votes
0 answers
58 views

Azure Synapse - Need to have table access to View?

I've been trying to find information on this for quite some time but I couldn't find any confirmed results. I know that we can grant access to view without granting explicit access to the base table ...
user avatar
  • 1
2 votes
1 answer
111 views

How to avoid returning partial data from SQL Server in .NET application?

We got ticket from client which is reporting that sometimes get partial data from query. In simple word query is a query on view: SELECT column1, column2, column3, column4, column5, column6 ... ...
user avatar
  • 307
0 votes
1 answer
14 views

What kind of object is made when we make CREATE VIEW, and what sort of commands can be ran on it?

I would like to understand the difference between a table and a View in SQL (Ms Access, if it makes any difference). So I know Create View command can be used to "pull" all fields and ...
user avatar
0 votes
1 answer
28 views

How to debug "General error: 1030 Got error 0 "Internal error/check (Not system error)" from storage engine Aria

(In other similar questions, the error number has been 168, in my case it's zero.) This occurs on attempting to load a massive view (which itself is a select query on another view). Many JOINS are ...
user avatar
0 votes
1 answer
70 views

Is it possible to force SQL Server to create a wrong view?

SQL Server has the capability to create a wrong synonym. For example: create synonym Sample for NonExistingObject This actually creates the Sample synonym. Also it's possible to create a view that ...
user avatar
5 votes
3 answers
290 views

Column property of updatable view is incorrect when inner join is used

I have a table atbl_UserSetting with a column with name ID which is a primary key with identity and a seed/increment. This table is accessible through a view for regular users. This is the view: ...
user avatar
  • 159
0 votes
0 answers
31 views

Why does postgres/citus use the index when querying the table, but not trough the view?

I have a Citus 9.5 database (postgres 11) on Azure and executing a complicated query with CTEs. The schema has a simple view from another schema as: create view my_schema.table1 as select * from ...
user avatar
0 votes
2 answers
71 views

Create view with inline function in db<>fiddle

I'm trying to create a view with in inline function in db<>fiddle. I've removed the CREATE VIEW part for now, and am just trying to run the query, just to get to the root issue. select /*+ ...
user avatar
  • 1,375
0 votes
0 answers
32 views

Are SQL views anything more than saved text?

I am trying to get a better understanding of an answer by @GarethD in https://stackoverflow.com/questions/24188350/incorrect-syntax-near-keyword-option-in-cte-statement?rq=1#answer-24188586 . In that ...
user avatar
  • 2,337
6 votes
3 answers
443 views

Views versus a function for getting the top records of a table?

I'm talking with a coworker about a way to approach a problem. We have a table that keeps track of a filling process, that has unique index columns (or should at least) on columns Lot and TestGrade. ...
user avatar
0 votes
1 answer
36 views

Postgres views for PII

How would I set up a view that is for showing a restricted set of data for masking PII? Can a view be created which is available at lesser role access than the source tables? This is for Postgres ...
user avatar
  • 111
0 votes
0 answers
45 views

fetch Postgres views definitions in correct order

Is there a way I can extract the definitions of all the views in a given Postgres schema in correct order? For example if a view 'A' depends on view 'B', is there a way/script/query which outputs the ...
user avatar
  • 13
0 votes
0 answers
23 views

Granting privileges on a view

I'm reading Database System Concept, in a chapter about authorization, the book first says that: A user who creates a view does not necessarily receive all privileges on that view. She receives only ...
user avatar
1 vote
2 answers
151 views

Indexing a view with an averaged column

With Sql-Server, I create this view: IF OBJECT_ID ('dbo.v_table', 'view') IS NOT NULL DROP VIEW [dbo].[v_table]; GO CREATE VIEW [dbo].[v_table] WITH SCHEMABINDING AS select toplevelcom_nr, avg(...
user avatar
  • 55
-1 votes
1 answer
73 views

How to assign minimal privileges for create view

In Db2 v11.1 on Linux we have a request to create a new user with access only to the "create view" privilege. What are minimal permissions I have to set in order for the user to be able ...
user avatar
  • 77
0 votes
2 answers
72 views

Inserting data into the VIEW , result in data being inserted into the original table, why is this happening?

I have a table as you can see below: create table table_test (col_id number(1)) The table has below data: col_id ------ 1 2 3 I create a view based on this table: create view v_table_test as ...
user avatar
  • 1,294
0 votes
1 answer
77 views

What is the best way to check performance for table vs view?

Could you please advice what is the best solution for compare performance of query for Table vs View. I mean have have two databases on same server (SQL Server 2016). Both include same data but in ...
user avatar
  • 45
0 votes
0 answers
19 views

View Expansion and Removing "dead variables"

I have a large set of interwoven views in Postgres that sometimes are make inefficient use of other views. For example, CREATE VIEW C AS SELECT A.a, B.b FROM A LEFT JOIN B on A.id = B.id Then, SELECT ...
user avatar
0 votes
0 answers
47 views

select which algorithm a view is using

I have a view in a MariaDB 10.4.13 database that feeds into a database documentation process and gathers data on tables and views used in the database. Amongst other fields it selects which algorithm ...
user avatar
0 votes
0 answers
40 views

MSSQL CDC for views and stored procedures

is it possible to enable CDC for Views or Stored procedures? BR, Val
user avatar
1 vote
0 answers
25 views

Creating the right index/es for querying views in SQL(ite3)

I have a python script that works by first creating some tables in a SQLite3 DB from lots of text files, then creating some views by joining the tables, and finally querying one of the views and ...
user avatar
  • 111
0 votes
0 answers
111 views

Convert jsonb column into view for Grafana

I have a partially dynamic data that I have to save into Postgres 13 and then visualize it in Grafana. Example for one document insert (partial) { "Timestamp": { "$date": { ...
user avatar
  • 11
0 votes
2 answers
173 views

How to improve performance to 12million rows table?

I have performance issues on a query in a big table (12 million records) based on Geonames, that's a read-only database so NO DELETE, UPDATE or INSERT only SELECT. There are queries I make every now ...
user avatar
1 vote
1 answer
152 views

Alter a view that refers to a non-readable secondary database

I have a database (DB1) that is not readable because it is secondary in an AG group. I have another database (DB2) that is not replicated with the AG group. It contains some views that reference the ...
user avatar
  • 3,367
0 votes
1 answer
25 views

Counting failed attempt

Here is my code: create table failed_login_attempts( login_id number(5) primary key, date_created timestamp default systimestamp, email varchar2(110), ip varchar2(24), mac varchar2(18), attempt number(...
user avatar
  • 13
1 vote
1 answer
44 views

Improving indexing of jsonb data when the json structure is well defined

I have a simple table records that contains a primary key (id) and a jsonb field (data). The structure of the jsonb is consistent across all rows. I have created a view (metadata) for this table which ...
user avatar
  • 111
0 votes
1 answer
822 views

How can I dynamically create views in Postgres 10 using variables?

I know how to do this in MySQL and MSSQL but I'm struggling to do the same in Postgres 10.12. I have about 200 views to create and the only difference in each one of them is the schema location and ...
user avatar
  • 249
0 votes
0 answers
418 views

MySQL Views breaking mysqldump command

While trying to backup all data from a mysql server with mysqldump I got this error root@server$ mysqldump -uroot -p --master-data=1 --single-transaction --flush-privileges --routines --triggers --...
user avatar
0 votes
1 answer
51 views

Return results from SQL JOIN even if criteria not met in all tables

New to SQL. Building my first contact manager project. Current schema can be seen below. Issue: I'm working on a view that shows all contact types (phone, email, socials, address) for a given contact....
user avatar
  • 111
0 votes
1 answer
44 views

Anyway to view original query on top of views using postgres

For example, I have a simple query: SELECT * FROM information_schema.columns where table_schema = 'public'; Which turn out very complex, information_schema.columns is a complex view. Right now, to ...
user avatar
  • 101
0 votes
1 answer
30 views

Using COUNT() implicitly for making a view over game match data?

I've not used SQL in quite a while and I'm pretty rusty it seems. I've had to do a project recently and needed to use MySQL on Windows and when looking for solutions to this particular query, I get ...
user avatar
  • 111
-1 votes
1 answer
75 views

What is the correct way to organize tables for a SQL view?

I'm new to data modeling. Currently working at creating a personal contact manager but I need some help with modeling the table relationships for a given view. The final view columns I'm shooting for ...
user avatar
  • 111
1 vote
1 answer
45 views

Different (much worse) query plan when using one view

I am running the following query: SELECT m.entityid, m.alias::text AS alias, m.measurement_ts, m.volume_m3::double precision AS volume_m3, m.pressure_mca, m.battery_volt, (m....
user avatar
  • 145
0 votes
1 answer
61 views

Query Store System View JOINs

In SQL Server 2016, is there an optimal/correct way to JOIN sys.query_store_query_text and sys.query_store_query (joinable using query_text_id) with sys.query_store_runtime_stats? I don't see any ...
user avatar
  • 119
2 votes
1 answer
109 views

Schema binding seems to not be enforced for view doing temporal query

I am using Microsoft SQL Server 2019. There are two strange behaviors that I don't see documented (if it is, please point me to the Microsoft docs link), I suspect they're related. The ...
user avatar
  • 155
1 vote
0 answers
57 views

MS SQL Server Enterprise 2016 is truncating the audited select statements, how do we fix it?

TL;DR; I am getting SELECT as the audit output instead of the actual (suspected) query SELECT DISTINCT CONVERT(varchar, DecryptByPassphrase(getkey(N'key1'), FIELD1)) as DECRYPTED_FIELD1 FROM view1 ...
user avatar
0 votes
0 answers
42 views

Does MySQL have a built-in way to tell whether a view is insertable (not just updatable)? E.g., something like the IS_UPDATABLE flag, but for INSERT?

The MySQL documentation for the INFORMATION_SCHEMA.VIEWS table mentions that MySQL sets a flag whenever a view is created that records whether that view is updatable, i.e., whether you can UPDATE the ...
user avatar
1 vote
0 answers
125 views

How to optimize MySQL VIEW performance?

All my years of development an this is my first post, so I hope I get this right. I hoping someone can help, my SQL skill is sufficient enough to get me by most of the time, but I'm having poor ...
user avatar
3 votes
0 answers
116 views

Time to generate execution plan for select into from a view takes significantly more time than select

I have a view, vw_example, that is quite complicated and has multiple joins across multiple databases. This view has been causing significant delays when used as part of other queries, and we've ...
user avatar
  • 131
1 vote
1 answer
349 views

Permission denied for view beyond its own schema

There are two schemes rohdaten_fiat and staging_fiat. I have created a view in the latter one based on the first one. CREATE VIEW staging_fiat.udz_odx_dtcs AS SELECT * FROM rohdaten_fiat....
user avatar

1
2 3 4 5
13