Subject | view on a table to speed up queries |
---|---|
Author | Jan Agermose |
Post date | 2002-04-22T10:35:33Z |
I'm looking for hints on using the database for logging. I tried having
a table called log that i insert into. To make it as fast as possible i
do not have any indexes on it except for the primary key.
The problem is that the log table grows very fast. This makes my "data
mining" very slow as there are now indexes and most queries seems to
visit all the rows to check if they are part of the result or not. Ways
out of this
1. log to different tables depending on the "log event" - makes it
harder (?) to look at merged result/data queries
2. log to the log-table and to different tables depending on the "log
event" - double the amount of inserts
3. same as 2, but done in a batch once every hour or day or something
like that - batch tables holding the data gives a less dynamic view of
the data
4. make a collection of views on the log table - but does this give any
performance gains? Is it faster to query a view like "select * from
myview" that if I had queried the table "select * from mytable where
logtype = 7" (myview would be defined as given of couse)
Jan Agermose
[Non-text portions of this message have been removed]
a table called log that i insert into. To make it as fast as possible i
do not have any indexes on it except for the primary key.
The problem is that the log table grows very fast. This makes my "data
mining" very slow as there are now indexes and most queries seems to
visit all the rows to check if they are part of the result or not. Ways
out of this
1. log to different tables depending on the "log event" - makes it
harder (?) to look at merged result/data queries
2. log to the log-table and to different tables depending on the "log
event" - double the amount of inserts
3. same as 2, but done in a batch once every hour or day or something
like that - batch tables holding the data gives a less dynamic view of
the data
4. make a collection of views on the log table - but does this give any
performance gains? Is it faster to query a view like "select * from
myview" that if I had queried the table "select * from mytable where
logtype = 7" (myview would be defined as given of couse)
Jan Agermose
[Non-text portions of this message have been removed]