Is it possible to build a psql query using param placeholders i.e. "SELECT * from issues WHERE state=$1;" ?
-
-
Replying to @schneems
e.g. `PREPARE myquery AS SELECT * FROM issues WHERE state = $1; EXECUTE myquery('TX')`
1 reply 0 retweets 1 like -
Replying to @sgrif
thanks! will this work with EXPLAIN and friends?
1 reply 0 retweets 0 likes -
The SELECT part will. EXPLAIN has the “Planning” and “Execution” times. Planning is covered by PREPARE, so EXECUTE should be Execution time.
1 reply 0 retweets 0 likes -
Nah I was wrong you can EXPLAIN [ANALYZE] EXECUTE. Even excludes Planning time.
1 reply 0 retweets 0 likes -
Replying to @calebthompson @schneems
I would think that depends on whether the query plan is cached or not
1 reply 0 retweets 1 like -
1 reply 0 retweets 1 like
Ah, but at least it'll show you super clearly whether it used a cached plan or not. Nice.
-
-
N.B.: there are some subtle differences between this and the protocol-level prepared statements your driver is probably using, but mostly
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.