Showing posts with label updated. Show all posts
Showing posts with label updated. Show all posts

Wednesday, March 21, 2012

from OLTP, DW, SSAS, to Report

Transaction db (such as AdentureWorks) changes all the time. If I'd like to see Report updated every day, DW and SSAS should be updated every night. Is there any sample (DTS) or ducoment for this issue?

Thanks!

-Z

I'd suggest you take a look at The Microsoft Datawarehouse Toolkit written by Joy Mundy and Warren Thornthwaite from the Kimball Group. It walks through all of the layers of a BI solution using Microsoft technology (from ETL to DW to SSAS to reporting) and discusses issues such as data latency, ETL schedules, near real-time updates, etc.

HTH,

Dave Fackler

|||

Thanks, Dave! It helps a lot!

-Z

Monday, March 12, 2012

frequently updated tables

Hi
I have a transaction table that is very frequently updated, so I have no
indexes on it. I also need to be able to run queries against this data on,
for example, a date range. I think the easiest solution would be to extract
data on a daily basis onto another table with indexes. Or should I be looking
at some sort of data warehousing/data cube approach? Any ideas/resources?
Thanks
if your just updating the table i dont see any reason why you couldnt
index that table and run data off of it. and if you would be able to
export it to a different table once a day i'm guess the data your
viewing isnt live data you need to see right away. i'd just index that
table and run queries off of it. just set all the tables your
selecting from 'WITH (NOLOCK)' then it wont matter if a record is
being access at that time. it doesnt sound like your worried about any
type of dirty reads. if it is being inserted into quite frequently you
might have to take another approach or run a job to reindex at night.
i'm not 100% sure of your exact situation. hope that helps.
|||We have been advised in the past that it wasn't a good idea to have indexes
on the transaction table that is being frequently written too i.e. less than
a second between inserts, but I'd still like to query the data. Without some
sort of index, the query ends up doing a full table scan on a massive table,
so I think I need some sort of extract to an indexed version to make these
queries manageable.
"GlennThomas5" wrote:

> if your just updating the table i dont see any reason why you couldnt
> index that table and run data off of it. and if you would be able to
> export it to a different table once a day i'm guess the data your
> viewing isnt live data you need to see right away. i'd just index that
> table and run queries off of it. just set all the tables your
> selecting from 'WITH (NOLOCK)' then it wont matter if a record is
> being access at that time. it doesnt sound like your worried about any
> type of dirty reads. if it is being inserted into quite frequently you
> might have to take another approach or run a job to reindex at night.
> i'm not 100% sure of your exact situation. hope that helps.
>
|||Who ever told you that certainly didn't know what they were talking about.
If you are going to update a row you need to know which row to update
otherwise you scan and most likely lock the entire table. If you need to
query it (which that is what tables are for) and don't want all the rows you
also need an index. The trick is to pick the right column(s) to index and
the correct index type. If you post the DDL for the table and a sample of
the queries you run against it we can help you decide on the proper
indexing.
Andrew J. Kelly SQL MVP
"Gary Homewood" <GaryHomewood@.discussions.microsoft.com> wrote in message
news:AE25E15B-FC19-4FDF-BEF1-DEAAA4671C5D@.microsoft.com...[vbcol=seagreen]
> We have been advised in the past that it wasn't a good idea to have
> indexes
> on the transaction table that is being frequently written too i.e. less
> than
> a second between inserts, but I'd still like to query the data. Without
> some
> sort of index, the query ends up doing a full table scan on a massive
> table,
> so I think I need some sort of extract to an indexed version to make these
> queries manageable.
>
> "GlennThomas5" wrote:
|||OK here's what I'm doing. My transaction table is written to potentially
several times a second; this is just an insert, not an update. I was under
the impression that if I had an index on such a large and rapidly expanding
table, there would be a performance hit when the index was recalculated as
rows are written to the table. I would subsequently like to retrieve results
from this table for a particular date range, in which case I do really need
an index on date to avoid doing a full table scan. Is there a way to get SQL
Server to maybe ignore the date index as rows are being inserted, and then
perhaps do a reindexing of the table once a day? Or do I need to extract data
to some sort of warehouse or data cube with a date index? In which case I'd
still have the same problem, because I'd need to extract entries from my very
large transaction table for a particular date.
Thanks for your replies so far. Hope I've phrased my problem a bit more
clearly this time.
"Andrew J. Kelly" wrote:

> Who ever told you that certainly didn't know what they were talking about.
> If you are going to update a row you need to know which row to update
> otherwise you scan and most likely lock the entire table. If you need to
> query it (which that is what tables are for) and don't want all the rows you
> also need an index. The trick is to pick the right column(s) to index and
> the correct index type. If you post the DDL for the table and a sample of
> the queries you run against it we can help you decide on the proper
> indexing.
> --
> Andrew J. Kelly SQL MVP
>
> "Gary Homewood" <GaryHomewood@.discussions.microsoft.com> wrote in message
> news:AE25E15B-FC19-4FDF-BEF1-DEAAA4671C5D@.microsoft.com...
>
>

frequently updated tables

Hi
I have a transaction table that is very frequently updated, so I have no
indexes on it. I also need to be able to run queries against this data on,
for example, a date range. I think the easiest solution would be to extract
data on a daily basis onto another table with indexes. Or should I be looking
at some sort of data warehousing/data cube approach? Any ideas/resources?
Thanksif your just updating the table i dont see any reason why you couldnt
index that table and run data off of it. and if you would be able to
export it to a different table once a day i'm guess the data your
viewing isnt live data you need to see right away. i'd just index that
table and run queries off of it. just set all the tables your
selecting from 'WITH (NOLOCK)' then it wont matter if a record is
being access at that time. it doesnt sound like your worried about any
type of dirty reads. if it is being inserted into quite frequently you
might have to take another approach or run a job to reindex at night.
i'm not 100% sure of your exact situation. hope that helps.|||We have been advised in the past that it wasn't a good idea to have indexes
on the transaction table that is being frequently written too i.e. less than
a second between inserts, but I'd still like to query the data. Without some
sort of index, the query ends up doing a full table scan on a massive table,
so I think I need some sort of extract to an indexed version to make these
queries manageable.
"GlennThomas5" wrote:
> if your just updating the table i dont see any reason why you couldnt
> index that table and run data off of it. and if you would be able to
> export it to a different table once a day i'm guess the data your
> viewing isnt live data you need to see right away. i'd just index that
> table and run queries off of it. just set all the tables your
> selecting from 'WITH (NOLOCK)' then it wont matter if a record is
> being access at that time. it doesnt sound like your worried about any
> type of dirty reads. if it is being inserted into quite frequently you
> might have to take another approach or run a job to reindex at night.
> i'm not 100% sure of your exact situation. hope that helps.
>|||Who ever told you that certainly didn't know what they were talking about.
If you are going to update a row you need to know which row to update
otherwise you scan and most likely lock the entire table. If you need to
query it (which that is what tables are for) and don't want all the rows you
also need an index. The trick is to pick the right column(s) to index and
the correct index type. If you post the DDL for the table and a sample of
the queries you run against it we can help you decide on the proper
indexing.
--
Andrew J. Kelly SQL MVP
"Gary Homewood" <GaryHomewood@.discussions.microsoft.com> wrote in message
news:AE25E15B-FC19-4FDF-BEF1-DEAAA4671C5D@.microsoft.com...
> We have been advised in the past that it wasn't a good idea to have
> indexes
> on the transaction table that is being frequently written too i.e. less
> than
> a second between inserts, but I'd still like to query the data. Without
> some
> sort of index, the query ends up doing a full table scan on a massive
> table,
> so I think I need some sort of extract to an indexed version to make these
> queries manageable.
>
> "GlennThomas5" wrote:
>> if your just updating the table i dont see any reason why you couldnt
>> index that table and run data off of it. and if you would be able to
>> export it to a different table once a day i'm guess the data your
>> viewing isnt live data you need to see right away. i'd just index that
>> table and run queries off of it. just set all the tables your
>> selecting from 'WITH (NOLOCK)' then it wont matter if a record is
>> being access at that time. it doesnt sound like your worried about any
>> type of dirty reads. if it is being inserted into quite frequently you
>> might have to take another approach or run a job to reindex at night.
>> i'm not 100% sure of your exact situation. hope that helps.
>>|||OK here's what I'm doing. My transaction table is written to potentially
several times a second; this is just an insert, not an update. I was under
the impression that if I had an index on such a large and rapidly expanding
table, there would be a performance hit when the index was recalculated as
rows are written to the table. I would subsequently like to retrieve results
from this table for a particular date range, in which case I do really need
an index on date to avoid doing a full table scan. Is there a way to get SQL
Server to maybe ignore the date index as rows are being inserted, and then
perhaps do a reindexing of the table once a day? Or do I need to extract data
to some sort of warehouse or data cube with a date index? In which case I'd
still have the same problem, because I'd need to extract entries from my very
large transaction table for a particular date.
Thanks for your replies so far. Hope I've phrased my problem a bit more
clearly this time.
"Andrew J. Kelly" wrote:
> Who ever told you that certainly didn't know what they were talking about.
> If you are going to update a row you need to know which row to update
> otherwise you scan and most likely lock the entire table. If you need to
> query it (which that is what tables are for) and don't want all the rows you
> also need an index. The trick is to pick the right column(s) to index and
> the correct index type. If you post the DDL for the table and a sample of
> the queries you run against it we can help you decide on the proper
> indexing.
> --
> Andrew J. Kelly SQL MVP
>
> "Gary Homewood" <GaryHomewood@.discussions.microsoft.com> wrote in message
> news:AE25E15B-FC19-4FDF-BEF1-DEAAA4671C5D@.microsoft.com...
> > We have been advised in the past that it wasn't a good idea to have
> > indexes
> > on the transaction table that is being frequently written too i.e. less
> > than
> > a second between inserts, but I'd still like to query the data. Without
> > some
> > sort of index, the query ends up doing a full table scan on a massive
> > table,
> > so I think I need some sort of extract to an indexed version to make these
> > queries manageable.
> >
> >
> >
> > "GlennThomas5" wrote:
> >
> >> if your just updating the table i dont see any reason why you couldnt
> >> index that table and run data off of it. and if you would be able to
> >> export it to a different table once a day i'm guess the data your
> >> viewing isnt live data you need to see right away. i'd just index that
> >> table and run queries off of it. just set all the tables your
> >> selecting from 'WITH (NOLOCK)' then it wont matter if a record is
> >> being access at that time. it doesnt sound like your worried about any
> >> type of dirty reads. if it is being inserted into quite frequently you
> >> might have to take another approach or run a job to reindex at night.
> >> i'm not 100% sure of your exact situation. hope that helps.
> >>
> >>
>
>

frequently updated tables

Hi
I have a transaction table that is very frequently updated, so I have no
indexes on it. I also need to be able to run queries against this data on,
for example, a date range. I think the easiest solution would be to extract
data on a daily basis onto another table with indexes. Or should I be lookin
g
at some sort of data warehousing/data cube approach? Any ideas/resources?
Thanksif your just updating the table i dont see any reason why you couldnt
index that table and run data off of it. and if you would be able to
export it to a different table once a day i'm guess the data your
viewing isnt live data you need to see right away. i'd just index that
table and run queries off of it. just set all the tables your
selecting from 'WITH (NOLOCK)' then it wont matter if a record is
being access at that time. it doesnt sound like your worried about any
type of dirty reads. if it is being inserted into quite frequently you
might have to take another approach or run a job to reindex at night.
i'm not 100% sure of your exact situation. hope that helps.|||We have been advised in the past that it wasn't a good idea to have indexes
on the transaction table that is being frequently written too i.e. less than
a second between inserts, but I'd still like to query the data. Without some
sort of index, the query ends up doing a full table scan on a massive table,
so I think I need some sort of extract to an indexed version to make these
queries manageable.
"GlennThomas5" wrote:

> if your just updating the table i dont see any reason why you couldnt
> index that table and run data off of it. and if you would be able to
> export it to a different table once a day i'm guess the data your
> viewing isnt live data you need to see right away. i'd just index that
> table and run queries off of it. just set all the tables your
> selecting from 'WITH (NOLOCK)' then it wont matter if a record is
> being access at that time. it doesnt sound like your worried about any
> type of dirty reads. if it is being inserted into quite frequently you
> might have to take another approach or run a job to reindex at night.
> i'm not 100% sure of your exact situation. hope that helps.
>|||Who ever told you that certainly didn't know what they were talking about.
If you are going to update a row you need to know which row to update
otherwise you scan and most likely lock the entire table. If you need to
query it (which that is what tables are for) and don't want all the rows you
also need an index. The trick is to pick the right column(s) to index and
the correct index type. If you post the DDL for the table and a sample of
the queries you run against it we can help you decide on the proper
indexing.
Andrew J. Kelly SQL MVP
"Gary Homewood" <GaryHomewood@.discussions.microsoft.com> wrote in message
news:AE25E15B-FC19-4FDF-BEF1-DEAAA4671C5D@.microsoft.com...[vbcol=seagreen]
> We have been advised in the past that it wasn't a good idea to have
> indexes
> on the transaction table that is being frequently written too i.e. less
> than
> a second between inserts, but I'd still like to query the data. Without
> some
> sort of index, the query ends up doing a full table scan on a massive
> table,
> so I think I need some sort of extract to an indexed version to make these
> queries manageable.
>
> "GlennThomas5" wrote:
>|||OK here's what I'm doing. My transaction table is written to potentially
several times a second; this is just an insert, not an update. I was under
the impression that if I had an index on such a large and rapidly expanding
table, there would be a performance hit when the index was recalculated as
rows are written to the table. I would subsequently like to retrieve results
from this table for a particular date range, in which case I do really need
an index on date to avoid doing a full table scan. Is there a way to get SQL
Server to maybe ignore the date index as rows are being inserted, and then
perhaps do a reindexing of the table once a day? Or do I need to extract dat
a
to some sort of warehouse or data cube with a date index? In which case I'd
still have the same problem, because I'd need to extract entries from my ver
y
large transaction table for a particular date.
Thanks for your replies so far. Hope I've phrased my problem a bit more
clearly this time.
"Andrew J. Kelly" wrote:

> Who ever told you that certainly didn't know what they were talking about.
> If you are going to update a row you need to know which row to update
> otherwise you scan and most likely lock the entire table. If you need to
> query it (which that is what tables are for) and don't want all the rows y
ou
> also need an index. The trick is to pick the right column(s) to index and
> the correct index type. If you post the DDL for the table and a sample of
> the queries you run against it we can help you decide on the proper
> indexing.
> --
> Andrew J. Kelly SQL MVP
>
> "Gary Homewood" <GaryHomewood@.discussions.microsoft.com> wrote in message
> news:AE25E15B-FC19-4FDF-BEF1-DEAAA4671C5D@.microsoft.com...
>
>

Frequently update and select Table Locking Problem

Hi guys,

I faced problem related to Locking and Isolation Level on Table(s).

My problems is there r some tables which r frequently updated, and I also want to fire select query over those tables every 1 seconds and want to get only committed records.

In current scenario we start transactions with Read Committed Lock for updating records. But in this scenario I can’t get select query result because of some of recourses r used by transactions so after some time it gives Deadlock error.

So I want solution like both operation run simultaneously and get only committed records at a time of transaction running.

Please help me for solving my problem.

It seems to me that a deadlock error would only happen if you were trying to update the same tables in different orders at the same time - i.e., Update tableA, tableB running at the same time as Update tableB, tableA. Txn1 would be waiting for Txn2 to finish, and Txn2 would be waiting for Txn1 to finish.

If what you are getting is just a locking block, it might be a different story.

|||

No in my scenario not happen as u told. In that only one trans running but by default the isolation level is READ_COMMITTED and in that when i trying to run select query it is going in waiting mode till trans is committed or roleback.

but i want to run both simultaniously and get only committed data

|||

Which version you are using 2000 or 2005? If you are using 2005, then i think you could use Snapshot isolation level.

|||

I am use 2005 .

I also found Snapshot Isolation solutions from google, but now my confusation is related to which of belowing two r better for my problem.

ALLOW_SNAPSHOT_ISOLATION

READ_COMMITTED_SNAPSHOT

Also I don't know differance about both of them. Please if u have any idea about them then tell me.

Thanks for giving this hint to solve my problem

|||

There is an excellent article about SQL Server 2005 Row Versioning Based Transaction Isolation.Here is the URL:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql90/html/sql2k5snapshotisol.asp

Please go through the article carefully and workout the examples specified in it.It would work for u.

Let me know if have any problems.

Frequently update and select Table Locking Problem

Hi guys,

I faced problem related to Locking and Isolation Level on Table(s).

My problems is there r some tables which r frequently updated, and I also want to fire select query over those tables every 1 seconds and want to get only committed records.

In current scenario we start transactions with ReadCommitted Lock for updating records. But in this scenario I can’t get select query result because of some of recourses r used by transactions so after some time it gives Deadlock error.

So I want solution like both operation run simultaneously and get only committed records at a time of transaction running

Please help me for solving my problem.

have you tried explicit dirty-read options in the select query ?

select * from mytable with (nolock) where mycolumn = 'hahaha'|||Yes I tried with that option, but it also return uncommitted data which i don't want.|||You cannot read "commited records" only of a transaction since those records actually does not exists untile the tran is closed: updated records are commited all together when you issue a commit transaction.|||

That's thing i knw, but the problem is when any trans for update or insert start on table I can't fire select query on that resources (means that table(s)) and it is going in waiting mode till trans is not committed or roleback.

So i resolve only this problems....

|||That's exactly the expected behavior if you use transactions.
You can use the 'with (rowlock)' option on the update (avoiding transactions) if you don't want other users to be put in wait, in that case a dirty read is allowed.|||

I got one solutions for resolving my problem using Snapshot Isolation.

But there are two types of Isolation READ_COMMITTED_SNAPSHOT and ALLOW_SNAPSHOT_ISOLATION

so If u have any idea about them please inform me.

Is this resolve my problem or not?

what is the differance between them?

|||

Try use

select * from SomeTable with(READPAST)

Quote from Server Books:

READPAST

Skip locked rows. This option causes a transaction to skip rows locked by other transactions that would ordinarily appear in the result set, rather than block the transaction waiting for the other transactions to release their locks on these rows. The READPAST lock hint applies only to transactions operating at READ COMMITTED isolation and will read only past row-level locks. Applies only to the SELECT statement.

|||

Two possibilities that I know of, and the one you suggest is one of them. Using snapshot you will get the way the row looked before it was in the process of being edited.

Using readpast, as Alexander suggests is the other.

The question is what the purpose of your read queries is:

If you want a periodic count of where you are in a process, use snapshot

If you want to fetch the next, unlocked row for editing, then use readpast. A common use of this might be a set of rows that you have clerks working on. So you might execute a query like:

select <columns>
from workToDo
where status = 'NOTSTARTED'

In this case it is desirous to skip exclusively locked rows as they might be in the process of being updated. Using snapshot in this case would stink because you never want the user to collide with itself.

|||

Snapshot isolation level is not available in MS SQL 2000.

>> select <columns>
>> from workToDo
>> where status = 'NOTSTARTED'

If there is no index on "status" field then deadlock may occur anyway. Even if there is index on "status" field deadlock may occur because if table is updated with large amount of data and distribution of key values has changed then server may ignore index until UPDATE STATISTICS executed (explicitly or due to it is marked as auto-updatable).

|||Thanks to all for giving different solution. I finally solved my problem using snapshot.