> Currently I have a trigger function that should store a value in tableX
> whenever a certain column in tableY gets changed.
> I do it with:
> a) delete from tableX where key = ( A, B ) ( regardless if there is one
> )
> b) insert into tableX
>
> This seems not very efficient though it works.
Yes, the problem is the nested loop scan - it's scanning users 609070
times, which is awful.
Could you provide explain plan that executed fast? Was it executed with
the same parameter values or did the parameters change (maybe it's slow
for some parameters values only)?
Have you tried to rewrite
What about replacing the table by
SELECT * FROM my_table ORDER BY num
i.e. something like
SELECT cat, LAST(id), LAST(num) FROM (SELECT * FROM my_table ORDER BY num)
AS foo GROUP_BY cat;
Hope it works, just guessing it might help :-)
regards
Tomas
> SELECT cat, MAX(num) FROM my_table GROUP_BY
> Hi,
>
> I have the following kind of sql structure, in 3 levels:
>
> ---
> create table documents (
> id serial,
> name varchar(50),
> primary key (id)
> );
>
> create table lines (
> id serial,
> name varchar(50),
> document_id integer,
> primary key (id),
> f
Hi,
we are developping a web application in which we need to manage access to
several types of objects, the most important objects are 'company', 'projects',
'subproject', 'module' (and several others but that's not important for now).
In general these objects constitute a tree, as for example eac
Hi,
I have a varchar column, and I need to
1) check the value in it is an integer
2) get the integer value (as integer)
The problem is I can't suppose the're only correct
values - ie there can be something like 'xssdkjsd',
'230kdd' or even an empty string etc.
I've been loo