Live data from Hacker News

Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

percona.com

1–10 of 18 posts

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#2
Why do people use "i.e." instead of "e.g."?

EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#3
post #2

Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.

well in this case they only really talk about the one function so i.e. is not incorrect.

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#4
post #2

Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.

Why do people use the wrong there/their/they're?

Why do people match salmon colored items with rose ones?

Why do people sing off key?

They aren't themselves sensitive to the difference and don't think about it.

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#5
post #2

Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.

"i.e." – for "id est" in latin – means "that is", or "in other words", "in essence".

"e.g." is "exempli gratia" in latin; just meaning "for example".

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#6
post #2

Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.

Because they mean absolutely different things: ”e.g.” stands for “exempli gratia” (“for example”) while “i.e.” stands for “id est” (”in other words”).

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#7
post #2

Why do people use "i.e." instead of "e.g."? EDIT:" For people who think I don't know what they mean, I do. I meant that the author of TFA obviously meant to write "Nondeterministic Functions in MySQL (e.g. Rand)", because the entire article is about all non-deterministic functions and just uses rand as an example.

well in this case they only really talk about the one function so i.e. is not incorrect.

They say "Functions" though.

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#8
I prefer to prepare the datasets first, and not depend on the order of evaluation (which you may fail to predict correctly):

  select * from some_table
  join (select rand() as random_id) on
    some_table.the_id = random_id
This way it is obvious that rand() will be evaluated only once.

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#9
For SQL Server it looks like an index seek on the following so it is evaluated once.

SELECT * FROM SomeTable WHERE ID = CAST(Rand() * 1000 as int)

In addition this query: SELECT TOP(100) rand() AS RandData from SomeTable

Returns: 0.940284064056996 0.940284064056996 0.940284064056996 . . . .

A old trick to actually get random data on SQL Server that I think has been replaced with newer functionality is:

SELECT ABS(CHECKSUM(NEWID())) FROM SomeTable

However if we move the NEWID.... stuff into the WHERE clause we end up switching to an index seek so back to being evaluated once.

Re: Nondeterministic Functions in MySQL (i.e. Rand) Can Surprise You

#10

Earlier quoted context omitted.

well in this case they only really talk about the one function so i.e. is not incorrect.

They say "Functions" though.

Here one would read “that is” as something like “specifically”.
Post reply on HN