2 ms·
Not shown: stop using SELECT *. You almost certainly do not need the entire width of the table, and by doing so, you add more data to filter and transmit, and a
by sgarland 2y ago
Not shown: stop using SELECT *. You almost certainly do not need the entire width of the table, and by doing so, you add more data to filter and transmit, and also prevent semijoins, which are awesome.
- yen223 2y agoThere are broadly two kinds of people who write SQL: analysts, and developers For developers, yeah. SELECT * has pitfalls, and you should almost always specify your columns or use a query builder that does that for you. For analysts though, life is short and sometimes you really don't want to type all the columns out. SELECT * is fine.
- higeorge13 2y agoAnalysts usually query data warehouses, which are columnar, so * is a query/warehouse killer. Everybody should just select the columns they need.
- mr_toad 2y agoThis is another area where I wish SQL was more composable. I’d love to be able to specify a bunch of columns using a single reference or a function, without having to resort to dynamic sql. Exclude and rename are a start, but not enough.
- sgarland 2y agoSo make a VIEW, then SELECT * from that. Non-materialized views are effectively free as far as the DB is concerned; make hundreds of them if you want.