News for hackers. Stuff that matters.
Re:Ask HN: Why sampling a database is not instantaneous? by perrygeo on Monday October 07, 2024 @08:05PM (#41772470)
Which database?

In postgres, the limit query can sometimes result in poor performance if the table statistics are not kept up to date. You can run `ANALYZE tablename` to refresh the stats manually, but the autovacuum process should do this periodically if configured correctly.

Re:Ask HN: Why sampling a database is not instantaneous? by whatever1 on Monday October 07, 2024 @08:16PM (#41772533)
Redshift with around 5TB of data (each row has ~ 30 columns)
Re:Ask HN: Why sampling a database is not instantaneous? by lesserknowndan on Tuesday October 08, 2024 @06:04PM (#41782264)
What exactly do you mean when you say "FROM database"?

If a "database" is a single table I would be surprised, however, if "database" is a view then potentially there is a lot that needs to go on under the hood to determine which 10 rows should be returned - particularly if something is doing a group by and cannot constrain it through any where constraints.