Обсуждение: Too much RAM allocated by webserver when executing an Insert-Statement (npgsql)
Too much RAM allocated by webserver when executing an Insert-Statement (npgsql)
Hi list,
I am using Npgsql to connect from a webapplication to a PostgreSQL Database. When I insert one row into a table (containing a filestream converted to bytea) the webserver allocates too much RAM for the webserver process (around 80MB when uploading a 4 MB file) and does not deallocate the RAM after executing the statement and closing the connection.
I know this is not directly related to PostgreSQL, but maybe someone of you has already has this behaviour and has some hints for me how to make the webserver not allocate as much space or at least deallocate the RAM after finishing the insert statement.
The Npgsql statement that causes this is:
insertstatement.ExecuteNonQuery()
Unfortunately I could not yet get any help in the Npgsql forums, maybe you can help me out.
I'd be grateful for any help.
Chris
Hello all, I have a complex structure as follows: CREATE TYPE ais_analyzer.schema_dates AS ( schema_name varchar(30), dates integer[], cursor_name "refcursor" ); This type is used in a stored procedure to temporary hold some data that are used to execute some secondary stored procedures that are different only be schema as follows: Declare m_schema_array ais_analyzer.schema_dates[]; BEGIN .........<some actions to populate the m_schema_array>....... FOR i IN 1..array_upper(m_schema_array, 1) LOOP RAISE NOTICE 'Schemas in array %', m_schema_array[i]; m_acursor := m_schema_array[i].cursor_name; OPEN m_acursor FOR EXECUTE 'SELECT * from ' || m_schema_array[i].schema_name || '.georef_stats($1,$2,$3)' USING p_feed_ids, m_schema_array[i].dates, p_georef; RETURN next m_acursor; END LOOP; RETURN; END; Having declared the m_schema_array as ais_analyzer.schema_dates[] seems to require more complex actions to access and modify the "items" of the type per array element while storing the type at a temporary table with only the field "dates" as integer[] makes things easier. However I am concerned about speed degradation if I use temporary tables since my array can have the most 12 rows and every row can have maximum 31 integers at the type.dates item. Furthermore the stored procedure that uses this custom type is called thousands of times (if not a few million times) so in the "temporary table solution" the temp table will be created millions of times. Any advice will be greatly appreciated. Kind Regards Yiannis