Re: The hidden cost of limit-offset

2020-12-06 Thread 孙冰
I think the subquery approach should be something like: --- select id, pg_sleep(0.1) from (select id from thing offset 90 order by tag) last_things --- Is that right? Then what if the interface is exposed as a view? e.g., --- create view thing_interface as select id, tag, pg_sleep(0.1) from thi

Partitioning with FDW and table size limits

2020-12-06 Thread Godfrin, Philippe E
Greetings, In the case where you have a 'local' server, from which you are working with foreign tables. And the foreign tables are partitioned. As each of the partitioned tables is a table in its own right, is it correct to assume the table (relation) size limit of 32 TB applies? For example, pr

JDBC driver - is "getGeneratedKeys()" guaranteed to return the ids in the same order a batch insert was made?

2020-12-06 Thread electrotype
Hi, Using JDBC, I batch insert multiple rows (/"executeBatch()/"). I then use /'//getGeneratedKeys("id")/' to get the generated ids ("id" is a "/SERIAL PRIMARY KEY/" column). My question: does the PostgreSQL JDBC driver /guarantees /that the order of the returned generated ids will be the sam

Re: SELECT but only if not present in another table

2020-12-06 Thread Alexander Farber
Thank you, Steve - On Sun, Dec 6, 2020 at 6:50 PM Steve Baldwin wrote: > Can't you just use table aliases? So, the outer word_moves would become > 'word_moves as wm', word_puzzles would become 'word_puzzles as wp', and the > where clause 'WHERE wp.mid = wm.mid' ? > table aliases have worked for

Re: SELECT but only if not present in another table

2020-12-06 Thread Steve Baldwin
Can't you just use table aliases? So, the outer word_moves would become 'word_moves as wm', word_puzzles would become 'word_puzzles as wp', and the where clause 'WHERE wp.mid = wm.mid' ? hth, Steve On Mon, Dec 7, 2020 at 4:08 AM Alexander Farber wrote: > Good evening, > > in PostgreSQL 13.1 I

SELECT but only if not present in another table

2020-12-06 Thread Alexander Farber
Good evening, in PostgreSQL 13.1 I save player moves in the table: # \d words_moves Table "public.words_moves" Column | Type | Collation | Nullable | Default -+--+---+--+--

Re: Using a boolean column with IF / THEN

2020-12-06 Thread Alexander Farber
On Sat, Dec 5, 2020 at 9:00 PM David G. Johnston wrote: > Maybe not “simpler” but for all those checks you could write a single > query that pulls out all the data at once into a record variable and test > against the columns pf that instead of executing multiple queries. > Thank you!

Re: The hidden cost of limit-offset

2020-12-06 Thread David G. Johnston
On Sunday, December 6, 2020, 孙冰 wrote: > The skipped rows by an OFFSET clause have to be computed nevertheless. I > am wondering if there could be any chance to improve, since the computation > is on the *entire* rows rather than on the *criterial* columns. > > [...] > > I don't understand the po