Tag Info

New answers tagged

1

There are a few things that might be causing this issue, but I can't be sure any of them are the real problem. The troubleshooting all involves turning on extra logging in the database, then seeing if the slow parts line up with messages there. Make sure you put a timestamp in the log_line_prefix setting to have useful logs to look at. See my tuning intro ...


1

You can definitely keep all your dimensions and measures in one fact table and not use any dimension tables. Make sure your OLAP tool supports this though. Normalizing out your dimensions into other tables is done mostly to minimize the size of the fact table, which can get large fast. With no dimension tables you're looking at about 336 MB per year (not ...


0

I'm no Postgres expert so this might be wrong! Your primary key has 3 columns, sessionID as the first field. Does the file contain a decent spread of timestamps? you might consider making that the first field in the primary key or using a surrogate key as currently this is fairly wide. From your script I dont think you have a cluster. Different to SQL ...


1

SELECT INTO is usually used to select specific set of data into a table, esp., during scenarios when the data in the table is the priority and not the constraints. It automatically creates a table if there is no such table already. But, INSERT INTO is used when you already have a table that has specific defined constraints and need to add data from a ...


1

Try to start a transaction or set autocommit=false prior the updates. start transaction; .... a lot of updates here ... commit; Also, the swapping may yield to the lack of physical RAM which occurs in some situations (big resources created by MySQL). You may also try to - increase the "key_buffer_size" to the maximum permitted by your SO and MySQL ...


1

Based on CL's suggestion to take another look at last_insert_rowid() and now that it's clear that INSTEAD OF triggers are only for VIEWs (see question's comments), here's a working version: -- We need a view to create the trigger on CREATE VIEW Container_Auto AS select * from Container; -- Since it's automatic we need to check if we need to create a root ...


2

A solution that might work for you is using the OUTPUT clause, which spits out all the inserted rows, so you can re-insert them into a different table. However, this puts limitations on foreign key constraints on Table2, if memory serves. Anyway, the solution would look something like this: MERGE INTO Table1 AS t1 USING MyTable ON 1=0 -- always generates ...


1

From reading your question, and the comments on the other answers, it seems like you are attempting to fix a problem with DataTable by splitting it into two new tables. I assume DataTable does not already have a single unique-field such as an IDENTITY(1,1)? If not, perhaps you should add one that you could use for inserting data into Table1 and Table2. By ...


0

The query select username from USERS where username like 'test%' .. returns more than one row. If you limit it to return only the first row, or rephrase the WHERE clause to return only a single row, you should be ok.


1

Seems like you want: INSERT dbo.Table1(A,B,C) SELECT A,B,C FROM dbo.DataTable WHERE <identify one row>; INSERT dbo.Table2(ID,D,E,F) SELECT SCOPE_IDENTITY(),D,E,F FROM dbo.DataTable WHERE <identify that same row>; Or maybe just use one table, if you're always going to have a row in each table... do you have a good reason for splitting ...


1

When you use the values clause in Oracle, you can only provide comma-separated values. If you want to select one or more rows from another table, you have to use this syntax: insert into <table>(<col1>,<col2>,...,<coln>) select <col1>,<col2>,...,<coln> from ...; In your case: insert into MEMBERS(GR_id, username) ...


3

If this is something you are planning to do regularly (i.e. it is part of the application logic and not a one-off data transformation exercise) then you could use a view onto Table1 and Table2 with an INSTEAD OF INSERT trigger to manage splitting the data (and arranging the keys/relationships) - then you would just do: INSERT newView SELECT NEWID(), A, B, ...



Top 50 recent answers are included