Thanks for the reply.
> The short answer is that PG doesn't cache query results. The only
> way it could
> do so safely is to lock all tables you access to make sure that no other
> process changes them. That would effectively turn PG into a
> single-user DB in
> short notice.
I am not sure I agree with you. I have done similar things with Oracle and
found that the second query will execute much more quickly than the first.
It could be made to work in at least two scenarios
- as a user/application perspective - you accept that the result might not
be up-to-date and take what comes back. This would be acceptable in my case
because I know that the tables will not change.
- the database could cache the result set. If some of the data is changed by
another query or session, then the database flushes the result set out of
> I assume these two queries are linked? If you rely on the max size being
> unchanged and have more than one process using the database, you
> should make
> sure you lock the rows in question.
I can rely on the max size remaining the same. As I mentioned above, the
tables are entirely read only. The data will not be updated or deleted by
anyone - I don't need to worry about that. The data will be updated en masse
once every 3 months.
> There is a discussion of the postgresql.conf file and how to tune it at:
Thanks for that.
> Given the explain attached, 16 secs seems slow. Could you post an EXPLAIN
> ANALYSE of either/both queries to the performance list. I'd drop
> the sql list
> when we're just talking about performance.
To be honest, my main concern was about the cache. If the second one could
use a cache amd execute in 2 seconds, that would be better that reducing the
execution of each individual query by 30% or so.
Thanks for the offer of help on this one. explain analyze gives me the same
as the last message - did you want verbose ?
Nested Loop (cost=0.00..147.11 rows=1 width=148) (actual
time=84.00..12323.00 rows=67 loops=1)
Join Filter: ("inner"."GEOM_ID_OF_POINT" = "outer"."POINT_ID")
-> Index Scan using gidx_oscar_point on oscar_point p (cost=0.00..61.34
rows=1 width=57) (actual time=0.00..9.00 rows=67 loops=1)
Index Cond: (wkb_geometry && 'SRID=-1;BOX3D(529540 179658.88
Filter: ((("TILE_REF" = 'TQ27NE'::bpchar) OR ("TILE_REF" =
char) OR ("TILE_REF" = 'TQ37NW'::bpchar) OR ("TILE_REF" = 'TQ38SW'::bpchar))
("FEAT_CODE" = 3500))
-> Index Scan using idx_on_tile_ref on oscar_node n (cost=0.00..85.74
rows=2 width=91) (actual time=0.06..150.07 rows=4797 loops=67)
Index Cond: (n."TILE_REF" = "outer"."TILE_REF")
Filter: (("TILE_REF" = 'TQ27NE'::bpchar) OR ("TILE_REF" =
'TQ28SE'::bpchar) OR ("TILE_REF" = 'TQ37NW'::bpchar) OR ("TILE_REF" =
Total runtime: 12325.00 msec
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]